File size: 618 Bytes
1267f62
 
 
1859c50
1267f62
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import gradio as gr
from huggingface_hub.inference_client import InferenceClient
import torch

# Initialize the Inference Client
client = InferenceClient(token="your-hf-token", repo_id="your-repo-id/model-id")

def chatbot(input_text):
    # Use the Inference Client to generate a response
    response = client.predict_step(input_text)
    return response

# Create a Gradio interface for the chatbot
interface = gr.Interface(
    fn=chatbot,
    inputs="text",
    outputs="text",
    title="Chatbot",
    description="A simple chatbot using Hugging Face Inference Client"
)

# Launch the chatbot
interface.launch()