|
import gradio as gr |
|
from transformers import pipeline |
|
|
|
|
|
chatbot_model = pipeline("text-generation", model="microsoft/DialoGPT-medium") |
|
|
|
|
|
def chat_with_zomato(user_input): |
|
|
|
response = chatbot_model(user_input, max_length=100, num_return_sequences=1)[0]["generated_text"] |
|
return response[len(user_input):].strip() |
|
|
|
|
|
def launch_zomato_chatbot(): |
|
|
|
chatbot_interface = gr.Interface( |
|
fn=chat_with_zomato, |
|
inputs=gr.Textbox(lines=2, placeholder="Ask Zomato..."), |
|
outputs="text", |
|
title="Zomato Chatbot", |
|
description="Ask Zomato anything about restaurants, food orders, or cuisine recommendations." |
|
) |
|
|
|
|
|
chatbot_interface.launch() |
|
|
|
|
|
if __name__ == "__main__": |
|
launch_zomato_chatbot() |
|
|