File size: 633 Bytes
ab4fd59
6fc3e25
4a21329
6fc3e25
f5a2edd
a6253f6
f5a2edd
915d8ef
6fc3e25
 
 
 
 
3a2b7bc
6fc3e25
 
3a2b7bc
6fc3e25
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import gradio as gr
from transformers import pipeline

# Load the DeepSeek model
# pipe = pipeline("text-generation", model="deepseek-ai/deepseek-llm-7b", trust_remote_code=True)

pipe = pipeline("text-generation", model="deepseek-ai/DeepSeek-R1", trust_remote_code=True)

# Function to interact with the chatbot
def chat_with_bot(message, chat_history):
    messages = [{"role": "user", "content": message}]
    response = pipe(messages, max_length=512)
    return response[0]["generated_text"]

# Create Gradio UI
interface = gr.ChatInterface(fn=chat_with_bot, title="DeepSeek AI Chatbot")

# Launch the chatbot
interface.launch()