Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -136,64 +136,38 @@ body {
|
|
136 |
font-family: 'Arial', sans-serif;
|
137 |
}
|
138 |
|
139 |
-
#
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
.header {
|
146 |
-
display: flex;
|
147 |
-
justify-content: space-between;
|
148 |
-
align-items: center;
|
149 |
-
margin-bottom: 2rem;
|
150 |
-
}
|
151 |
-
|
152 |
-
.header select {
|
153 |
-
background-color: #1e293b;
|
154 |
-
color: #e2e8f0;
|
155 |
-
padding: 0.5rem 1rem;
|
156 |
-
border-radius: 0.375rem;
|
157 |
-
border: none;
|
158 |
-
font-size: 1rem;
|
159 |
-
}
|
160 |
-
|
161 |
-
.header button {
|
162 |
-
background-color: #3b82f6;
|
163 |
-
color: white;
|
164 |
-
padding: 0.5rem 1rem;
|
165 |
-
border-radius: 0.375rem;
|
166 |
-
border: none;
|
167 |
-
cursor: pointer;
|
168 |
-
font-size: 1rem;
|
169 |
}
|
170 |
|
171 |
-
h1 {
|
172 |
font-size: 2.5rem;
|
173 |
margin-bottom: 0.5rem;
|
174 |
-
text-align: center;
|
175 |
}
|
176 |
|
177 |
-
h1 .blue {
|
178 |
color: #60a5fa;
|
179 |
}
|
180 |
|
181 |
-
h1 .pink {
|
182 |
color: #f472b6;
|
183 |
}
|
184 |
|
185 |
-
h2 {
|
186 |
font-size: 1.5rem;
|
187 |
color: #94a3b8;
|
188 |
-
margin-bottom: 2rem;
|
189 |
-
text-align: center;
|
190 |
}
|
191 |
|
192 |
.suggestions {
|
193 |
-
display:
|
194 |
-
|
|
|
195 |
gap: 1rem;
|
196 |
-
margin
|
197 |
}
|
198 |
|
199 |
.suggestion {
|
@@ -203,6 +177,7 @@ h2 {
|
|
203 |
display: flex;
|
204 |
align-items: center;
|
205 |
transition: transform 0.3s ease;
|
|
|
206 |
}
|
207 |
|
208 |
.suggestion:hover {
|
@@ -221,25 +196,8 @@ h2 {
|
|
221 |
max-width: 100% !important;
|
222 |
}
|
223 |
|
224 |
-
|
225 |
-
|
226 |
-
border-radius: 0.5rem !important;
|
227 |
-
margin-bottom: 1rem !important;
|
228 |
-
}
|
229 |
-
|
230 |
-
.input-container input, .input-container textarea {
|
231 |
-
background-color: #2d3748 !important;
|
232 |
-
border: none !important;
|
233 |
-
color: #e2e8f0 !important;
|
234 |
-
}
|
235 |
-
|
236 |
-
#component-0 {
|
237 |
-
max-width: 600px;
|
238 |
-
margin: 0 auto;
|
239 |
-
}
|
240 |
-
|
241 |
-
#component-1, #component-2 {
|
242 |
-
height: 150px !important;
|
243 |
}
|
244 |
|
245 |
footer {
|
@@ -249,70 +207,75 @@ footer {
|
|
249 |
}
|
250 |
"""
|
251 |
|
252 |
-
#
|
253 |
-
|
254 |
-
<div id="
|
255 |
-
<
|
256 |
-
<
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
</header>
|
261 |
-
<main>
|
262 |
-
<h1>
|
263 |
-
<span class="blue">Hello,</span>
|
264 |
-
<span class="pink">User</span>
|
265 |
-
</h1>
|
266 |
-
<h2>How can I help you today?</h2>
|
267 |
-
<div class="suggestions">
|
268 |
-
<div class="suggestion">
|
269 |
-
<span class="suggestion-icon">🎤</span>
|
270 |
-
<p>Speak in any Indic language</p>
|
271 |
-
</div>
|
272 |
-
<div class="suggestion">
|
273 |
-
<span class="suggestion-icon">⌨️</span>
|
274 |
-
<p>Type in any Indic language</p>
|
275 |
-
</div>
|
276 |
-
<div class="suggestion">
|
277 |
-
<span class="suggestion-icon">🤖</span>
|
278 |
-
<p>Get AI-generated responses</p>
|
279 |
-
</div>
|
280 |
-
<div class="suggestion">
|
281 |
-
<span class="suggestion-icon">🔊</span>
|
282 |
-
<p>Listen to audio responses</p>
|
283 |
-
</div>
|
284 |
-
</div>
|
285 |
-
</main>
|
286 |
-
<footer>
|
287 |
-
Powered by Indic Language AI
|
288 |
-
</footer>
|
289 |
</div>
|
290 |
"""
|
291 |
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
314 |
)
|
315 |
-
|
|
|
316 |
|
317 |
# Launch the app
|
318 |
iface.launch()
|
|
|
136 |
font-family: 'Arial', sans-serif;
|
137 |
}
|
138 |
|
139 |
+
#custom-header {
|
140 |
+
text-align: center;
|
141 |
+
padding: 20px 0;
|
142 |
+
background-color: #1a202c;
|
143 |
+
margin-bottom: 20px;
|
144 |
+
border-radius: 10px;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
145 |
}
|
146 |
|
147 |
+
#custom-header h1 {
|
148 |
font-size: 2.5rem;
|
149 |
margin-bottom: 0.5rem;
|
|
|
150 |
}
|
151 |
|
152 |
+
#custom-header h1 .blue {
|
153 |
color: #60a5fa;
|
154 |
}
|
155 |
|
156 |
+
#custom-header h1 .pink {
|
157 |
color: #f472b6;
|
158 |
}
|
159 |
|
160 |
+
#custom-header h2 {
|
161 |
font-size: 1.5rem;
|
162 |
color: #94a3b8;
|
|
|
|
|
163 |
}
|
164 |
|
165 |
.suggestions {
|
166 |
+
display: flex;
|
167 |
+
justify-content: center;
|
168 |
+
flex-wrap: wrap;
|
169 |
gap: 1rem;
|
170 |
+
margin: 20px 0;
|
171 |
}
|
172 |
|
173 |
.suggestion {
|
|
|
177 |
display: flex;
|
178 |
align-items: center;
|
179 |
transition: transform 0.3s ease;
|
180 |
+
width: 200px;
|
181 |
}
|
182 |
|
183 |
.suggestion:hover {
|
|
|
196 |
max-width: 100% !important;
|
197 |
}
|
198 |
|
199 |
+
#component-0, #component-1, #component-2 {
|
200 |
+
max-width: 100% !important;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
201 |
}
|
202 |
|
203 |
footer {
|
|
|
207 |
}
|
208 |
"""
|
209 |
|
210 |
+
# Custom HTML for the header
|
211 |
+
custom_header = """
|
212 |
+
<div id="custom-header">
|
213 |
+
<h1>
|
214 |
+
<span class="blue">Hello,</span>
|
215 |
+
<span class="pink">User</span>
|
216 |
+
</h1>
|
217 |
+
<h2>How can I help you today?</h2>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
218 |
</div>
|
219 |
"""
|
220 |
|
221 |
+
# Custom HTML for suggestions
|
222 |
+
custom_suggestions = """
|
223 |
+
<div class="suggestions">
|
224 |
+
<div class="suggestion">
|
225 |
+
<span class="suggestion-icon">🎤</span>
|
226 |
+
<p>Speak in any Indic language</p>
|
227 |
+
</div>
|
228 |
+
<div class="suggestion">
|
229 |
+
<span class="suggestion-icon">⌨️</span>
|
230 |
+
<p>Type in any Indic language</p>
|
231 |
+
</div>
|
232 |
+
<div class="suggestion">
|
233 |
+
<span class="suggestion-icon">🤖</span>
|
234 |
+
<p>Get AI-generated responses</p>
|
235 |
+
</div>
|
236 |
+
<div class="suggestion">
|
237 |
+
<span class="suggestion-icon">🔊</span>
|
238 |
+
<p>Listen to audio responses</p>
|
239 |
+
</div>
|
240 |
+
</div>
|
241 |
+
"""
|
242 |
+
|
243 |
+
# Create Gradio interface
|
244 |
+
with gr.Blocks(css=custom_css, theme=gr.themes.Base().set(
|
245 |
+
body_background_fill="#0b0f19",
|
246 |
+
body_text_color="#e2e8f0",
|
247 |
+
button_primary_background_fill="#3b82f6",
|
248 |
+
button_primary_background_fill_hover="#2563eb",
|
249 |
+
button_primary_text_color="white",
|
250 |
+
block_title_text_color="#94a3b8",
|
251 |
+
block_label_text_color="#94a3b8",
|
252 |
+
)) as iface:
|
253 |
+
gr.HTML(custom_header)
|
254 |
+
gr.HTML(custom_suggestions)
|
255 |
+
|
256 |
+
with gr.Row():
|
257 |
+
with gr.Column(scale=1):
|
258 |
+
gr.Markdown("### Indic Assistant")
|
259 |
+
with gr.Column(scale=1, min_width=100):
|
260 |
+
gr.Button("Try Advanced Features", size="sm")
|
261 |
+
|
262 |
+
input_type = gr.Radio(["audio", "text"], label="Input Type", value="audio")
|
263 |
+
audio_input = gr.Audio(type="filepath", label="Speak (if audio input selected)")
|
264 |
+
text_input = gr.Textbox(label="Type your message (if text input selected)")
|
265 |
+
|
266 |
+
submit_btn = gr.Button("Submit")
|
267 |
+
|
268 |
+
output_transcription = gr.Textbox(label="Transcription/Input")
|
269 |
+
output_response = gr.Textbox(label="Generated Response")
|
270 |
+
output_audio = gr.Audio(label="Audio Response")
|
271 |
+
|
272 |
+
submit_btn.click(
|
273 |
+
fn=indic_language_assistant,
|
274 |
+
inputs=[input_type, audio_input, text_input],
|
275 |
+
outputs=[output_transcription, output_response, output_audio]
|
276 |
)
|
277 |
+
|
278 |
+
gr.HTML("<footer>Powered by Indic Language AI</footer>")
|
279 |
|
280 |
# Launch the app
|
281 |
iface.launch()
|