Bestcoder_GPT / app.py
KRayRay's picture
Update app.py
5876457 verified
raw
history blame
748 Bytes
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()