Spaces:
Running
Running
Cosmetic Changes
Browse files
app.py
CHANGED
@@ -187,6 +187,33 @@ custom_css = """
|
|
187 |
color: #34495e;
|
188 |
margin: 10px 0;
|
189 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
190 |
"""
|
191 |
|
192 |
# Create the Gradio interface with enhanced UI
|
@@ -276,6 +303,12 @@ with gr.Blocks(css=custom_css, theme=gr.themes.Soft()) as demo:
|
|
276 |
output = gr.Markdown(
|
277 |
label="Generated Response(s)",
|
278 |
show_label=True,
|
|
|
|
|
|
|
|
|
|
|
|
|
279 |
)
|
280 |
|
281 |
gr.Markdown(
|
@@ -307,26 +340,23 @@ with gr.Blocks(css=custom_css, theme=gr.themes.Soft()) as demo:
|
|
307 |
elem_classes="description"
|
308 |
)
|
309 |
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
],
|
324 |
-
inputs=prompt
|
325 |
-
)
|
326 |
|
327 |
# Connect the interface
|
328 |
generate_btn.click(
|
329 |
-
fn=
|
330 |
inputs=[
|
331 |
prompt,
|
332 |
max_length,
|
|
|
187 |
color: #34495e;
|
188 |
margin: 10px 0;
|
189 |
}
|
190 |
+
.loading {
|
191 |
+
display: flex;
|
192 |
+
align-items: center;
|
193 |
+
justify-content: center;
|
194 |
+
padding: 20px;
|
195 |
+
background-color: #f8f9fa;
|
196 |
+
border-radius: 8px;
|
197 |
+
margin: 10px 0;
|
198 |
+
}
|
199 |
+
.loading-spinner {
|
200 |
+
width: 40px;
|
201 |
+
height: 40px;
|
202 |
+
border: 4px solid #f3f3f3;
|
203 |
+
border-top: 4px solid #3498db;
|
204 |
+
border-radius: 50%;
|
205 |
+
animation: spin 1s linear infinite;
|
206 |
+
margin-right: 15px;
|
207 |
+
}
|
208 |
+
@keyframes spin {
|
209 |
+
0% { transform: rotate(0deg); }
|
210 |
+
100% { transform: rotate(360deg); }
|
211 |
+
}
|
212 |
+
.loading-text {
|
213 |
+
color: #2c3e50;
|
214 |
+
font-size: 1.1em;
|
215 |
+
font-weight: 500;
|
216 |
+
}
|
217 |
"""
|
218 |
|
219 |
# Create the Gradio interface with enhanced UI
|
|
|
303 |
output = gr.Markdown(
|
304 |
label="Generated Response(s)",
|
305 |
show_label=True,
|
306 |
+
value="Your generated responses will appear here...", # Add default value
|
307 |
+
)
|
308 |
+
loading_status = gr.Markdown(
|
309 |
+
value="",
|
310 |
+
show_label=False,
|
311 |
+
elem_classes="loading"
|
312 |
)
|
313 |
|
314 |
gr.Markdown(
|
|
|
340 |
elem_classes="description"
|
341 |
)
|
342 |
|
343 |
+
def generate_with_status(*args):
|
344 |
+
# Show loading status
|
345 |
+
loading_status.value = """
|
346 |
+
<div class="loading">
|
347 |
+
<div class="loading-spinner"></div>
|
348 |
+
<div class="loading-text">Generating responses... Please wait...</div>
|
349 |
+
</div>
|
350 |
+
"""
|
351 |
+
# Generate response
|
352 |
+
result = generate_response(*args)
|
353 |
+
# Clear loading status
|
354 |
+
loading_status.value = ""
|
355 |
+
return result
|
|
|
|
|
|
|
356 |
|
357 |
# Connect the interface
|
358 |
generate_btn.click(
|
359 |
+
fn=generate_with_status,
|
360 |
inputs=[
|
361 |
prompt,
|
362 |
max_length,
|