Abdalkaderdev commited on
Commit
cda2b92
·
1 Parent(s): 4aaef3d

Add beautiful custom styling to Gradio interface

Browse files
Files changed (1) hide show
  1. app/gradio_interface.py +171 -6
app/gradio_interface.py CHANGED
@@ -1,5 +1,5 @@
1
  """
2
- Gradio interface for ORA - Fast GPU testing
3
  This runs alongside the FastAPI server for quick testing with ZeroGPU
4
  """
5
 
@@ -100,21 +100,186 @@ Respond with compassion and wisdom."""
100
 
101
  return response
102
 
103
- # Create Gradio interface
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
104
  demo = gr.ChatInterface(
105
  fn=generate_response,
106
- title="🙏 ORA - Spiritual AI Assistant (GPU Testing)",
107
- description="Fast GPU-powered testing interface for ORA. Ask theological questions, seek spiritual guidance, or discuss scripture.",
108
  examples=[
109
  "What does the Bible say about finding peace in difficult times?",
110
  "How can I grow closer to God?",
111
  "Explain the parable of the prodigal son",
112
  "What is the meaning of faith?",
113
  ],
114
- theme=gr.themes.Soft(),
 
 
 
 
 
 
115
  retry_btn=None,
116
  undo_btn=None,
117
- clear_btn="Clear",
 
118
  )
119
 
120
  if __name__ == "__main__":
 
1
  """
2
+ Gradio interface for ORA - Fast GPU testing with beautiful UI
3
  This runs alongside the FastAPI server for quick testing with ZeroGPU
4
  """
5
 
 
100
 
101
  return response
102
 
103
+ # Custom CSS for beautiful UI matching the Orb interface
104
+ custom_css = """
105
+ @import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;600&family=Crimson+Text:ital@0;1&display=swap');
106
+
107
+ /* Dark theme with purple/blue gradients */
108
+ .gradio-container {
109
+ background: linear-gradient(135deg, #0f0c29 0%, #302b63 50%, #24243e 100%) !important;
110
+ font-family: 'Inter', sans-serif !important;
111
+ }
112
+
113
+ /* Header styling */
114
+ .gradio-container h1 {
115
+ background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
116
+ -webkit-background-clip: text;
117
+ -webkit-text-fill-color: transparent;
118
+ font-size: 3rem !important;
119
+ font-weight: 600 !important;
120
+ text-align: center !important;
121
+ margin-bottom: 0.5rem !important;
122
+ animation: fadeIn 1s ease-in;
123
+ }
124
+
125
+ /* Description text */
126
+ .gradio-container p {
127
+ color: #a0aec0 !important;
128
+ text-align: center !important;
129
+ font-size: 1.1rem !important;
130
+ margin-bottom: 2rem !important;
131
+ }
132
+
133
+ /* Chat container */
134
+ .message-wrap {
135
+ background: rgba(255, 255, 255, 0.05) !important;
136
+ backdrop-filter: blur(10px) !important;
137
+ border-radius: 20px !important;
138
+ border: 1px solid rgba(255, 255, 255, 0.1) !important;
139
+ padding: 1.5rem !important;
140
+ animation: slideUp 0.5s ease-out;
141
+ }
142
+
143
+ /* User messages */
144
+ .message.user {
145
+ background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
146
+ color: white !important;
147
+ border-radius: 18px !important;
148
+ padding: 1rem 1.5rem !important;
149
+ font-family: 'Inter', sans-serif !important;
150
+ box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3) !important;
151
+ animation: messageSlide 0.3s ease-out;
152
+ }
153
+
154
+ /* Bot messages */
155
+ .message.bot {
156
+ background: rgba(255, 255, 255, 0.08) !important;
157
+ color: #e2e8f0 !important;
158
+ border-radius: 18px !important;
159
+ padding: 1rem 1.5rem !important;
160
+ font-family: 'Crimson Text', serif !important;
161
+ font-size: 1.1rem !important;
162
+ line-height: 1.8 !important;
163
+ border: 1px solid rgba(255, 255, 255, 0.1) !important;
164
+ animation: messageSlide 0.3s ease-out;
165
+ }
166
+
167
+ /* Input box */
168
+ .input-box {
169
+ background: rgba(255, 255, 255, 0.05) !important;
170
+ border: 2px solid rgba(102, 126, 234, 0.3) !important;
171
+ border-radius: 25px !important;
172
+ color: white !important;
173
+ padding: 1rem 1.5rem !important;
174
+ font-size: 1rem !important;
175
+ transition: all 0.3s ease !important;
176
+ }
177
+
178
+ .input-box:focus {
179
+ border-color: #667eea !important;
180
+ box-shadow: 0 0 20px rgba(102, 126, 234, 0.4) !important;
181
+ outline: none !important;
182
+ }
183
+
184
+ /* Send button */
185
+ .send-button {
186
+ background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
187
+ border: none !important;
188
+ border-radius: 20px !important;
189
+ padding: 0.8rem 2rem !important;
190
+ color: white !important;
191
+ font-weight: 600 !important;
192
+ cursor: pointer !important;
193
+ transition: all 0.3s ease !important;
194
+ box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4) !important;
195
+ }
196
+
197
+ .send-button:hover {
198
+ transform: translateY(-2px) !important;
199
+ box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6) !important;
200
+ }
201
+
202
+ /* Examples */
203
+ .examples {
204
+ background: rgba(255, 255, 255, 0.03) !important;
205
+ border-radius: 15px !important;
206
+ padding: 1rem !important;
207
+ border: 1px solid rgba(255, 255, 255, 0.1) !important;
208
+ }
209
+
210
+ .example-btn {
211
+ background: rgba(102, 126, 234, 0.1) !important;
212
+ border: 1px solid rgba(102, 126, 234, 0.3) !important;
213
+ color: #a0aec0 !important;
214
+ border-radius: 12px !important;
215
+ padding: 0.7rem 1.2rem !important;
216
+ transition: all 0.3s ease !important;
217
+ }
218
+
219
+ .example-btn:hover {
220
+ background: rgba(102, 126, 234, 0.2) !important;
221
+ border-color: #667eea !important;
222
+ color: white !important;
223
+ transform: translateY(-2px) !important;
224
+ }
225
+
226
+ /* Animations */
227
+ @keyframes fadeIn {
228
+ from { opacity: 0; transform: translateY(-20px); }
229
+ to { opacity: 1; transform: translateY(0); }
230
+ }
231
+
232
+ @keyframes slideUp {
233
+ from { opacity: 0; transform: translateY(30px); }
234
+ to { opacity: 1; transform: translateY(0); }
235
+ }
236
+
237
+ @keyframes messageSlide {
238
+ from { opacity: 0; transform: translateX(-20px); }
239
+ to { opacity: 1; transform: translateX(0); }
240
+ }
241
+
242
+ /* Scrollbar */
243
+ ::-webkit-scrollbar {
244
+ width: 8px;
245
+ }
246
+
247
+ ::-webkit-scrollbar-track {
248
+ background: rgba(255, 255, 255, 0.05);
249
+ }
250
+
251
+ ::-webkit-scrollbar-thumb {
252
+ background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
253
+ border-radius: 10px;
254
+ }
255
+
256
+ ::-webkit-scrollbar-thumb:hover {
257
+ background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
258
+ }
259
+ """
260
+
261
+ # Create Gradio interface with custom theme
262
  demo = gr.ChatInterface(
263
  fn=generate_response,
264
+ title="🙏 ORA",
265
+ description=" Your Spiritual AI Companion Powered by ZeroGPU for Lightning-Fast Responses ",
266
  examples=[
267
  "What does the Bible say about finding peace in difficult times?",
268
  "How can I grow closer to God?",
269
  "Explain the parable of the prodigal son",
270
  "What is the meaning of faith?",
271
  ],
272
+ theme=gr.themes.Soft(
273
+ primary_hue="purple",
274
+ secondary_hue="blue",
275
+ neutral_hue="slate",
276
+ font=["Inter", "Crimson Text", "sans-serif"]
277
+ ),
278
+ css=custom_css,
279
  retry_btn=None,
280
  undo_btn=None,
281
+ clear_btn="✨ New Conversation",
282
+ submit_btn="🙏 Ask ORA",
283
  )
284
 
285
  if __name__ == "__main__":