File size: 3,804 Bytes
9c39d26
211a063
 
2f9659d
9c39d26
2f9659d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4fafe9d
2f9659d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9c39d26
2f9659d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9c39d26
2f9659d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9c39d26
 
2f9659d
9c39d26
2f9659d
 
 
 
 
 
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
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
    )