Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
from transformers import pipeline
|
3 |
+
|
4 |
+
def chat_with_model(user_input):
|
5 |
+
messages = [{"role": "user", "content": user_input}]
|
6 |
+
pipe = pipeline("text-generation", model="deepseek-ai/DeepSeek-R1", trust_remote_code=True)
|
7 |
+
response = pipe(messages)
|
8 |
+
return response[0]['generated_text']
|
9 |
+
|
10 |
+
iface = gr.Interface(
|
11 |
+
fn=chat_with_model,
|
12 |
+
inputs=gr.Textbox(label="Enter your message"),
|
13 |
+
outputs=gr.Textbox(label="Model Response"),
|
14 |
+
title="Chat with DeepSeek-R1",
|
15 |
+
description="Enter a message to interact with the DeepSeek-R1 model."
|
16 |
+
)
|
17 |
+
|
18 |
+
iface.launch()
|