File size: 585 Bytes
b4fff27
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import gradio as gr
from transformers import pipeline

def chat_with_model(user_input):
    messages = [{"role": "user", "content": user_input}]
    pipe = pipeline("text-generation", model="deepseek-ai/DeepSeek-R1", trust_remote_code=True)
    response = pipe(messages)
    return response[0]['generated_text']

iface = gr.Interface(
    fn=chat_with_model,
    inputs=gr.Textbox(label="Enter your message"),
    outputs=gr.Textbox(label="Model Response"),
    title="Chat with DeepSeek-R1",
    description="Enter a message to interact with the DeepSeek-R1 model."
)

iface.launch()