File size: 1,080 Bytes
975e0d1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
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()