Skip to main content
Gradio is an open-source python library for building interactive web applications to showcase machine learning models, APIs, and python functions. The sambanova-gradio package extends Gradio’s capabilities by simplifying SambaNova model integration. It provides a user-friendly interface for developers to connect SambaNova models to their applications. The sambanova-gradio package has two dependencies: OpenAI and Gradio. It streamlines the setup process with a built-in registry function, sambanova_gradio.registry, which facilitates seamless connections to various models. The registry function accepts a model ID as the name parameter. Executing the script automatically generates an application interface using the specified model. For implementation details and additional configurations, see the sambanova-gradio GitHub repository.

Prerequisites

Installation

Follow these steps to integrate SambaNova models with Gradio.
1

Install the sambanova-gradio package

2

Set your SambaNova API key

Create a Gradio interface

Use the sambanova_gradio.registry function to build and launch your Gradio application, as shown below.
Running this Python script will launch a Gradio interface connected to the Meta-Llama-3.3-70B-Instruct model.

Customize your interface

You can personalize the interface by modifying the model, input/output components, and additional settings to gr.Interface, as shown below.

Example screenshot

The following interface was generated using the above code snippet.
Gradio chat interface with Meta-Llama-3.3-70B-Instruct
See more examples of Gradio applications in the SambaNova HuggingFace space.

Troubleshooting

Package not installed or installed in wrong environment. Run pip install sambanova-gradio and verify with pip show sambanova-gradio.
API key missing or invalid. Confirm SAMBANOVA_API_KEY is set: echo "${SAMBANOVA_API_KEY:0:10}...". Re-export if empty.
Check the model ID is correct. See available models for valid IDs.