> ## Documentation Index
> Fetch the complete documentation index at: https://sambanova-systems.mintlify.site/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Gradio integration guide

Gradio is an open-source python library for building interactive web applications to showcase machine learning models, APIs, and python functions. The [sambanova-gradio](https://github.com/gradio-app/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 GitHub repository.

## Prerequisites

* A [SambaCloud](http://cloud.sambanova.ai?utm_source=gradio\&utm_medium=external\&utm_campaign=cloud_signup) account
* An API key from your SambaNova dashboard

## Installation

Follow these steps to integrate SambaNova models with Gradio.

<Steps>
  <Step title="Install the sambanova-gradio package by running the command below to install the required package.">
    ```python theme={null}
    pip install sambanova-gradio
    ```
  </Step>

  <Step title="Set Your SambaNova API Key by saving your API key as an environment variable, as shown below.">
    ```python theme={null}
    export SAMBANOVA_API_KEY=<your token>
    ```
  </Step>
</Steps>

## Create a Gradio interface

Use the `sambanova_gradio.registry` function to build and launch your Gradio application, as shown below.

<Note>
  Running this Python script will launch a Gradio interface connected to the Meta-Llama-3.3-70B-Instruct model.
</Note>

```python theme={null}
import gradio as gr
import sambanova_gradio

gr.load(
    name='Meta-Llama-3.3-70B-Instruct',
    src=sambanova_gradio.registry,
).launch()
```

### Customize your interface

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

```python theme={null}
import gradio as gr
import sambanova_gradio

gr.load(
    name='Meta-Llama-3.3-70B-Instruct',
    src=sambanova_gradio.registry,
    title='Sambanova-Gradio Integration',
    description="Chat with Meta-Llama-3.3-70B-Instruct model.",
    examples=["Explain quantum gravity to a 5-year old.", "How many R are there in the word Strawberry?"]
).launch()
```

#### Example screenshot

The following interface was generated using the above code snippet.

<img src="https://mintcdn.com/sambanova-systems/tKEjjixpklKce6C2/images/docs/integrations/gradio/gradio1.png?fit=max&auto=format&n=tKEjjixpklKce6C2&q=85&s=d8af59b394a8d8dd2e879fbd54e63ff0" alt="Gradio chat interface with Meta-Llama-3.3-70B-Instruct" width="756" height="498" data-path="images/docs/integrations/gradio/gradio1.png" />

See more examples of Gradio applications in the [SambaNova HuggingFace space](/en/build/hf-spaces).
