SatyamSinghal commited on
Commit
05c60b9
·
verified ·
1 Parent(s): 1dd01ba

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +82 -1
app.py CHANGED
@@ -84,4 +84,85 @@ header, footer {
84
  padding: 1rem;
85
  border-radius: 15px;
86
  margin-bottom: 1rem;
87
- box-shadow: 0px 4px 15px rgba(0, 0,
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
84
  padding: 1rem;
85
  border-radius: 15px;
86
  margin-bottom: 1rem;
87
+ box-shadow: 0px 4px 15px rgba(0, 0, 0, 0.2);
88
+ }
89
+
90
+ .chatbot-container {
91
+ display: flex;
92
+ flex-direction: column;
93
+ justify-content: space-between;
94
+ border-radius: 15px;
95
+ background: rgba(255, 255, 255, 0.8);
96
+ padding: 1rem;
97
+ height: 400px;
98
+ overflow-y: auto;
99
+ box-shadow: 0px 4px 15px rgba(0, 0, 0, 0.2);
100
+ }
101
+
102
+ input, button {
103
+ border: none;
104
+ padding: 0.8rem;
105
+ border-radius: 10px;
106
+ margin: 0.5rem 0;
107
+ outline: none;
108
+ }
109
+
110
+ input {
111
+ background: #fff;
112
+ color: #333;
113
+ font-size: 1rem;
114
+ }
115
+
116
+ button {
117
+ background: linear-gradient(90deg, #6a11cb, #2575fc);
118
+ color: white;
119
+ font-weight: bold;
120
+ cursor: pointer;
121
+ transition: transform 0.2s, background 0.2s;
122
+ }
123
+
124
+ button:hover {
125
+ transform: scale(1.05);
126
+ background: linear-gradient(90deg, #2575fc, #6a11cb);
127
+ }
128
+
129
+ .chat-category {
130
+ background: rgba(0, 0, 0, 0.05);
131
+ border: 2px solid #ff7eb3;
132
+ margin: 1rem 0;
133
+ padding: 1rem;
134
+ border-radius: 10px;
135
+ transition: transform 0.2s, box-shadow 0.2s;
136
+ }
137
+
138
+ .chat-category:hover {
139
+ transform: translateY(-3px);
140
+ box-shadow: 0px 4px 15px rgba(255, 127, 179, 0.5);
141
+ }
142
+ """)
143
+
144
+ with chat_interface:
145
+ with gr.Row():
146
+ gr.Markdown("<h1 style='text-align:center;'>🌈 Vibrant Motivational Chatbot</h1>")
147
+ with gr.Row():
148
+ gr.Markdown("**Feeling stressed or unmotivated? Share your thoughts and let me help!**")
149
+ with gr.Row():
150
+ chatbot_output = gr.Chatbot(label="Motivator Bot")
151
+ with gr.Row():
152
+ user_input = gr.Textbox(label="Your Message", placeholder="Type something...")
153
+ send_button = gr.Button("Send")
154
+ with gr.Row():
155
+ saved_chats_display = gr.HTML(label="Saved Chats", value=display_saved_chats())
156
+ refresh_button = gr.Button("Refresh Saved Chats")
157
+
158
+ def handle_interaction(user_input, history):
159
+ if not user_input.strip():
160
+ return history, display_saved_chats()
161
+ updated_history, _ = chatbot(user_input, history)
162
+ return updated_history, display_saved_chats()
163
+
164
+ send_button.click(handle_interaction, inputs=[user_input, chatbot_output], outputs=[chatbot_output, saved_chats_display])
165
+ refresh_button.click(display_saved_chats, inputs=[], outputs=saved_chats_display)
166
+
167
+ if __name__ == "__main__":
168
+ chat_interface.launch()