Spaces:
Sleeping
Sleeping
File size: 929 Bytes
f60e304 5a39748 f60e304 421b7c3 f60e304 421b7c3 f60e304 421b7c3 f60e304 421b7c3 f60e304 421b7c3 5a39748 f60e304 421b7c3 f60e304 5a39748 f60e304 204d28c | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 | # import gradio as gr
# def greet(name):
# return "Hello " + name + "!!"
# iface = gr.Interface(fn=greet, inputs="text", outputs="text")
# iface.launch()
import gradio as gr
import torch
from transformers import Conversation, pipeline
model_name = "facebook/blenderbot-400M-distill"
chatbot = pipeline("conversational", model=model_name)
# Define the chatbot function
def generate_response(input_text):
conversation = Conversation()
conversation.add_user_input(input_text)
response = chatbot(conversation)
return response
# .choices[0]['message']['content']
# Set up the Gradio interface
iface = gr.Interface(
fn=generate_response,
inputs=gr.inputs.Textbox(placeholder="Enter your message..."),
outputs="text",
title="Conversational Chatbot",
description="An AI-powered chatbot that engages in conversation.",
theme="default"
)
# Launch the Gradio interface
iface.launch() |