Update app.py
Browse files
app.py
CHANGED
|
@@ -83,12 +83,26 @@ with gr.Blocks() as demo:
|
|
| 83 |
|
| 84 |
submit = gr.Button("Generate Design")
|
| 85 |
output = gr.Markdown(label="Output")
|
| 86 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 87 |
|
| 88 |
def wrapper(*args):
|
| 89 |
-
|
|
|
|
|
|
|
| 90 |
result = generate_software_spec(*args)
|
| 91 |
-
|
|
|
|
| 92 |
output.update(value=result)
|
| 93 |
|
| 94 |
submit.click(fn=wrapper,
|
|
|
|
| 83 |
|
| 84 |
submit = gr.Button("Generate Design")
|
| 85 |
output = gr.Markdown(label="Output")
|
| 86 |
+
with gr.Row():
|
| 87 |
+
with gr.Column():
|
| 88 |
+
spinner = gr.HTML("""
|
| 89 |
+
<div id="loading" style="display: none; text-align: center;">
|
| 90 |
+
<svg width="40" height="40" viewBox="0 0 100 100" preserveAspectRatio="xMidYMid">
|
| 91 |
+
<circle cx="50" cy="50" fill="none" stroke="#4fa94d" stroke-width="10" r="35" stroke-dasharray="164.93361431346415 56.97787143782138">
|
| 92 |
+
<animateTransform attributeName="transform" type="rotate" repeatCount="indefinite" dur="1s" values="0 50 50;360 50 50" keyTimes="0;1"></animateTransform>
|
| 93 |
+
</circle>
|
| 94 |
+
</svg>
|
| 95 |
+
<p>Generating...</p>
|
| 96 |
+
</div>
|
| 97 |
+
""")
|
| 98 |
|
| 99 |
def wrapper(*args):
|
| 100 |
+
from IPython.display import Javascript
|
| 101 |
+
print("Showing spinner...")
|
| 102 |
+
spinner.update(value='<script>document.getElementById("loading").style.display = "block";</script>')
|
| 103 |
result = generate_software_spec(*args)
|
| 104 |
+
print("Hiding spinner...")
|
| 105 |
+
spinner.update(value='<script>document.getElementById("loading").style.display = "none";</script>')
|
| 106 |
output.update(value=result)
|
| 107 |
|
| 108 |
submit.click(fn=wrapper,
|