|
|
import gradio as gr |
|
|
from transformers import pipeline |
|
|
|
|
|
|
|
|
doggoz_model = pipeline("text-generation", model="gpt2") |
|
|
|
|
|
def answer_question(question): |
|
|
|
|
|
response = doggoz_model(question, max_length=100, num_return_sequences=1) |
|
|
return response[0]['generated_text'] |
|
|
|
|
|
|
|
|
custom_css = """ |
|
|
body { |
|
|
background-color: #f4e3d7; /* Light brown background */ |
|
|
font-family: 'Comic Sans MS', cursive; |
|
|
} |
|
|
h1 { |
|
|
color: #8b4513; /* Brown color for headings */ |
|
|
} |
|
|
""" |
|
|
|
|
|
|
|
|
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 |
|
|
) |
|
|
|
|
|
|
|
|
interface.launch() |