Spaces:
Sleeping
Sleeping
import gradio as gr | |
import os | |
class RafayyAIAssistant: | |
def __init__(self): | |
self.responses = { | |
"greeting": """π Welcome to Rafayy's Virtual Try-On Studio! How can I help you today? | |
β’ Type 'features' to learn about our services | |
β’ Type 'pricing' for subscription plans | |
β’ Type 'help' for usage tips | |
β’ Type 'contact' for support""", | |
"features": """β¨ Our AI-Powered Features: | |
1. Virtual Clothing Try-On | |
β’ Upload your photo | |
β’ Describe any clothing | |
β’ Get instant visualization | |
2. Professional Quality | |
β’ High-resolution output | |
β’ Realistic clothing rendering | |
β’ Advanced style controls | |
3. Easy to Use | |
β’ Simple interface | |
β’ Quick processing | |
β’ Multiple style options""", | |
"pricing": """π Subscription Plans: | |
1. Basic Plan - $9.99/month | |
β’ 100 try-ons per month | |
β’ Standard resolution | |
β’ Basic support | |
2. Pro Plan - $29.99/month | |
β’ 500 try-ons per month | |
β’ HD resolution | |
β’ Priority support | |
3. Enterprise Plan - Custom pricing | |
β’ Unlimited try-ons | |
β’ Ultra HD resolution | |
β’ Dedicated support""", | |
"help": """π Quick Tips: | |
1. For Best Results: | |
β’ Use clear, front-facing photos | |
β’ Ensure good lighting | |
β’ Wear fitted clothing | |
2. When Describing Clothes: | |
β’ Be specific about style | |
β’ Mention colors clearly | |
β’ Include design details | |
3. Troubleshooting: | |
β’ Retry if result isn't perfect | |
β’ Adjust style strength | |
β’ Check example prompts""", | |
"contact": """π§ Contact & Support: | |
β’ Email: [email protected] | |
β’ Hours: 24/7 | |
β’ Response time: Within 24 hours | |
For immediate help, try our FAQ section or usage tips.""" | |
} | |
def get_response(self, message): | |
"""Generate response based on user input""" | |
message = message.lower().strip() | |
# Check for keywords and return appropriate response | |
if message in ['hi', 'hello', 'hey', 'start']: | |
return self.responses["greeting"] | |
elif 'feature' in message or 'can' in message or 'what' in message: | |
return self.responses["features"] | |
elif 'price' in message or 'cost' in message or 'plan' in message: | |
return self.responses["pricing"] | |
elif 'help' in message or 'how' in message or 'tip' in message: | |
return self.responses["help"] | |
elif 'contact' in message or 'support' in message or 'email' in message: | |
return self.responses["contact"] | |
else: | |
return self.responses["greeting"] | |
# Initialize the chatbot | |
chatbot = RafayyAIAssistant() | |
# Create the Gradio interface | |
demo = gr.Interface( | |
fn=chatbot.get_response, | |
inputs=gr.Textbox( | |
placeholder="Ask me anything about Rafayy's Virtual Try-On Studio...", | |
label="Your Message" | |
), | |
outputs=gr.Textbox( | |
label="AI Assistant", | |
lines=10 | |
), | |
title="π€ Rafayy AI Assistant", | |
description="""Welcome to Rafayy's Virtual Try-On Studio Support! | |
I'm here to help you with features, pricing, and usage tips.""", | |
theme="soft", | |
css=""" | |
.gradio-container { | |
font-family: 'Arial', sans-serif; | |
} | |
.gr-button { | |
background: linear-gradient(45deg, #2193b0, #6dd5ed) !important; | |
border: none !important; | |
} | |
.gr-button:hover { | |
background: linear-gradient(45deg, #6dd5ed, #2193b0) !important; | |
transform: translateY(-2px); | |
transition: all 0.3s ease; | |
} | |
""" | |
) | |
# Launch the interface | |
if __name__ == "__main__": | |
demo.launch( | |
server_name="0.0.0.0", | |
server_port=7860, | |
share=False, | |
show_error=True | |
) |