Spaces:
Sleeping
Sleeping
import gradio as gr | |
from transformers import pipeline | |
# Initialize Hugging Face's DialoGPT model for conversational AI | |
generator = pipeline("conversational", model="microsoft/DialoGPT-medium") | |
# Function that interacts with the Hugging Face model | |
def chatbot_response(user_input): | |
response = generator(user_input) | |
return response[0]['generated_text'] | |
# Gradio interface setup | |
def create_gradio_interface(): | |
# Create a Gradio interface with input and output components | |
interface = gr.Interface( | |
fn=chatbot_response, | |
inputs=gr.Textbox(label="Your Message", placeholder="Ask about food customization..."), | |
outputs=gr.Textbox(label="Bot Response"), | |
title="Food Customization Assistant", | |
description="Talk to the bot and customize your food preferences. Ask about recipes, categories, or ingredients.", | |
theme="compact" # You can customize the theme | |
) | |
return interface | |
if __name__ == "__main__": | |
interface = create_gradio_interface() | |
interface.launch() | |