sagar007 commited on
Commit
64a205f
·
verified ·
1 Parent(s): a703b55

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +146 -57
app.py CHANGED
@@ -129,87 +129,169 @@ def indic_language_assistant(input_type, audio_input, text_input):
129
 
130
 
131
 
132
- # Updated Custom CSS for dark theme
133
  custom_css = """
134
  body {
135
- background-color: #0b0f19;
136
- color: #ffffff;
 
137
  }
138
 
139
  #indic-assistant {
140
- background: rgba(255, 255, 255, 0.05);
 
141
  padding: 20px;
142
- border-radius: 10px;
143
- box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
144
- margin-bottom: 20px;
145
  }
146
 
147
- #indic-assistant h1 {
148
- color: #ff6b6b;
149
- font-size: 2em;
150
- margin-bottom: 10px;
 
151
  }
152
 
153
- .concept {
154
- display: inline-block;
155
- margin: 0 10px;
156
- transition: transform 0.3s;
 
 
157
  }
158
 
159
- .concept:hover {
160
- transform: scale(1.1);
 
 
 
 
 
161
  }
162
 
163
- .concept img {
164
- width: 50px;
165
- height: 50px;
166
- border-radius: 10px;
167
- background-color: #2c3e50;
168
- padding: 10px;
169
  }
170
 
171
- .concept-description {
172
- color: #bdc3c7;
173
- margin-top: 5px;
174
- font-size: 0.9em;
175
  }
176
 
177
- .input-box, .output-box {
178
- background-color: #1e2a38 !important;
179
- border: 1px solid #34495e !important;
180
- color: #ecf0f1 !important;
181
  }
182
 
183
- .submit-btn {
184
- background-color: #ff6b6b !important;
185
- color: white !important;
 
186
  }
187
 
188
- .submit-btn:hover {
189
- background-color: #ff8787 !important;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
190
  }
191
  """
192
 
193
- # Updated Custom HTML
194
  custom_html = """
195
  <div id="indic-assistant">
196
- <h1>Indic Language Virtual Assistant</h1>
197
- <p>Speak or type in any supported Indic language or English. The assistant will respond in text and audio.</p>
198
-
199
- <div style="display: flex; justify-content: center; gap: 20px; margin-top: 20px;">
200
- <div class="concept">
201
- <img src="https://img.icons8.com/nolan/64/microphone.png" alt="Audio Input">
202
- <div class="concept-description">Speak in any Indic language</div>
203
  </div>
204
- <div class="concept">
205
- <img src="https://img.icons8.com/nolan/64/keyboard.png" alt="Text Input">
206
- <div class="concept-description">Type in any Indic language</div>
207
  </div>
208
- <div class="concept">
209
- <img src="https://img.icons8.com/nolan/64/artificial-intelligence.png" alt="AI Response">
210
- <div class="concept-description">Get AI-generated responses</div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
211
  </div>
212
- </div>
 
 
 
 
 
 
213
  </div>
214
  """
215
 
@@ -219,18 +301,25 @@ iface = gr.Interface(
219
  inputs=[
220
  gr.Radio(["audio", "text"], label="Input Type", value="audio"),
221
  gr.Audio(type="filepath", label="Speak (if audio input selected)"),
222
- gr.Textbox(label="Type your message (if text input selected)", elem_classes="input-box")
223
  ],
224
  outputs=[
225
- gr.Textbox(label="Transcription/Input", elem_classes="output-box"),
226
- gr.Textbox(label="Generated Response", elem_classes="output-box"),
227
  gr.Audio(label="Audio Response")
228
  ],
229
- title="Indic Language Virtual Assistant",
230
- description="Speak or type in any supported Indic language or English. The assistant will respond in text and audio.",
231
  css=custom_css,
232
  article=custom_html,
233
- theme="dark"
 
 
 
 
 
 
 
 
 
234
  )
235
 
236
  # Launch the app
 
129
 
130
 
131
 
132
+ # Custom CSS
133
  custom_css = """
134
  body {
135
+ background-color: #1a202c;
136
+ color: #e2e8f0;
137
+ font-family: Arial, sans-serif;
138
  }
139
 
140
  #indic-assistant {
141
+ max-width: 800px;
142
+ margin: 0 auto;
143
  padding: 20px;
 
 
 
144
  }
145
 
146
+ .header {
147
+ display: flex;
148
+ justify-content: space-between;
149
+ align-items: center;
150
+ margin-bottom: 2rem;
151
  }
152
 
153
+ .header select {
154
+ background-color: #2d3748;
155
+ color: #e2e8f0;
156
+ padding: 0.5rem;
157
+ border-radius: 0.375rem;
158
+ border: none;
159
  }
160
 
161
+ .header button {
162
+ background-color: #3182ce;
163
+ color: white;
164
+ padding: 0.5rem 1rem;
165
+ border-radius: 0.375rem;
166
+ border: none;
167
+ cursor: pointer;
168
  }
169
 
170
+ h1 {
171
+ font-size: 2.25rem;
172
+ margin-bottom: 0.5rem;
 
 
 
173
  }
174
 
175
+ h1 .blue {
176
+ color: #63b3ed;
 
 
177
  }
178
 
179
+ h1 .pink {
180
+ color: #ed64a6;
 
 
181
  }
182
 
183
+ h2 {
184
+ font-size: 1.5rem;
185
+ color: #a0aec0;
186
+ margin-bottom: 2rem;
187
  }
188
 
189
+ .suggestions {
190
+ display: grid;
191
+ grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
192
+ gap: 1rem;
193
+ margin-bottom: 2rem;
194
+ }
195
+
196
+ .suggestion {
197
+ background-color: #2d3748;
198
+ border-radius: 0.5rem;
199
+ padding: 1rem;
200
+ display: flex;
201
+ align-items: flex-start;
202
+ }
203
+
204
+ .suggestion-icon {
205
+ font-size: 1.5rem;
206
+ margin-right: 1rem;
207
+ }
208
+
209
+ .input-container {
210
+ position: relative;
211
+ margin-bottom: 1rem;
212
+ }
213
+
214
+ .input-container input {
215
+ width: 100%;
216
+ background-color: #2d3748;
217
+ border: none;
218
+ border-radius: 9999px;
219
+ padding: 0.75rem 3rem 0.75rem 1.5rem;
220
+ color: #e2e8f0;
221
+ }
222
+
223
+ .input-container .icons {
224
+ position: absolute;
225
+ right: 1rem;
226
+ top: 50%;
227
+ transform: translateY(-50%);
228
+ display: flex;
229
+ align-items: center;
230
+ }
231
+
232
+ .input-container .icons svg {
233
+ width: 1.5rem;
234
+ height: 1.5rem;
235
+ margin-left: 0.5rem;
236
+ cursor: pointer;
237
+ }
238
+
239
+ footer {
240
+ position: fixed;
241
+ bottom: 1rem;
242
+ left: 1rem;
243
+ }
244
+
245
+ footer svg {
246
+ width: 1.5rem;
247
+ height: 1.5rem;
248
  }
249
  """
250
 
251
+ # Custom HTML
252
  custom_html = """
253
  <div id="indic-assistant">
254
+ <header class="header">
255
+ <div>
256
+ <select>
257
+ <option>Indic Assistant</option>
258
+ </select>
 
 
259
  </div>
260
+ <div>
261
+ <button>Try Advanced Features</button>
 
262
  </div>
263
+ </header>
264
+ <main>
265
+ <h1>
266
+ <span class="blue">Hello,</span>
267
+ <span class="pink">User</span>
268
+ </h1>
269
+ <h2>How can I help you today?</h2>
270
+ <div class="suggestions">
271
+ <div class="suggestion">
272
+ <span class="suggestion-icon">🎤</span>
273
+ <p>Speak in any Indic language</p>
274
+ </div>
275
+ <div class="suggestion">
276
+ <span class="suggestion-icon">⌨️</span>
277
+ <p>Type in any Indic language</p>
278
+ </div>
279
+ <div class="suggestion">
280
+ <span class="suggestion-icon">🤖</span>
281
+ <p>Get AI-generated responses</p>
282
+ </div>
283
+ <div class="suggestion">
284
+ <span class="suggestion-icon">🔊</span>
285
+ <p>Listen to audio responses</p>
286
+ </div>
287
  </div>
288
+ </main>
289
+ <footer>
290
+ <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
291
+ <circle cx="12" cy="12" r="3"></circle>
292
+ <path d="M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-2 2 2 2 0 0 1-2-2v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1-2-2 2 2 0 0 1 2-2h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 2-2 2 2 0 0 1 2 2v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 2 2 2 2 0 0 1-2 2h-.09a1.65 1.65 0 0 0-1.51 1z"></path>
293
+ </svg>
294
+ </footer>
295
  </div>
296
  """
297
 
 
301
  inputs=[
302
  gr.Radio(["audio", "text"], label="Input Type", value="audio"),
303
  gr.Audio(type="filepath", label="Speak (if audio input selected)"),
304
+ gr.Textbox(label="Type your message (if text input selected)", elem_classes="input-container")
305
  ],
306
  outputs=[
307
+ gr.Textbox(label="Transcription/Input"),
308
+ gr.Textbox(label="Generated Response"),
309
  gr.Audio(label="Audio Response")
310
  ],
 
 
311
  css=custom_css,
312
  article=custom_html,
313
+ theme=gr.themes.Base().set(
314
+ body_background_fill="*background_color",
315
+ body_background_fill_dark="*background_color_dark",
316
+ body_text_color="*neutral_800",
317
+ body_text_color_dark="*neutral_200",
318
+ button_primary_background_fill="*primary_500",
319
+ button_primary_background_fill_hover="*primary_600",
320
+ button_primary_text_color="white",
321
+ button_primary_text_color_dark="white",
322
+ )
323
  )
324
 
325
  # Launch the app