Spaces:
Sleeping
Sleeping
Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from transformers import pipeline
|
| 2 |
+
import gradio as gr
|
| 3 |
+
|
| 4 |
+
|
| 5 |
+
chatbot = pipeline("text-generation", model="deepseek-ai/DeepSeek-R1")
|
| 6 |
+
|
| 7 |
+
def chat_with_bot(user_input):
|
| 8 |
+
# Generate a response from the chatbot model
|
| 9 |
+
response = chatbot(user_input)
|
| 10 |
+
return response[0]['generated_text']
|
| 11 |
+
|
| 12 |
+
interface = gr.Interface(
|
| 13 |
+
fn=chat_with_bot, # Function to call for processing the input
|
| 14 |
+
inputs=gr.Textbox(label="Enter your message"), # User input (text)
|
| 15 |
+
outputs=gr.Textbox(label="Chatbot Response"), # Model output (text)
|
| 16 |
+
title="Chat with DeepSeek", # Optional: Add a title to your interface
|
| 17 |
+
description="Chat with an AI model powered by DeepSeek!" # Optional: Add a description
|
| 18 |
+
)
|
| 19 |
+
interface.launch()
|