Spaces:
Sleeping
Sleeping
File size: 748 Bytes
5a13686 5876457 5a13686 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
import gradio as gr
from transformers import pipeline
# BlenderBot-400M
chatbot = pipeline("text2text-generation", model="facebook/blenderbot-400M-distill")
# Chat function
def chat(prompt):
response = chatbot(prompt, max_length=50, do_sample=True, temperature=0.7)
return response[0]["generated_text"]
# create Gradio Web App
with gr.Blocks() as demo:
gr.Markdown("## 🤖 Bestcoder Chatbot - Powered by BlenderBot")
gr.Image("logo.png", width=400)
prompt_input = gr.Textbox(label="Enter your message")
submit_button = gr.Button("Generate Response")
output_text = gr.Markdown("### AI Response will appear here ⬇️")
submit_button.click(chat, inputs=prompt_input, outputs=output_text)
# lunch
demo.launch()
|