import gradio as gr from transformers import pipeline # Load a pre-trained model (replace with your fine-tuned model if available) doggoz_model = pipeline("text-generation", model="gpt2") def answer_question(question): # Generate a response using the model response = doggoz_model(question, max_length=100, num_return_sequences=1) return response[0]['generated_text'] # Custom CSS for a dog-themed UI custom_css = """ body { background-color: #f4e3d7; /* Light brown background */ font-family: 'Comic Sans MS', cursive; } h1 { color: #8b4513; /* Brown color for headings */ } """ # Create a Gradio interface with custom theme interface = gr.Interface( fn=answer_question, inputs=gr.Textbox(lines=2, placeholder="Ask me anything about dogs...", label="Your Question"), outputs=gr.Textbox(lines=4, label="Doggoz Answer 🐾"), title="🐾 Doggoz - Your Dog Assistant 🐾", description="Ask me anything about dogs! I can help with health, training, products, and more.", css=custom_css ) # Launch the interface interface.launch()