Spaces:
Sleeping
Sleeping
| 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() | |