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: support@rafayy.ai • 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 )