Update app.py
Browse files
app.py
CHANGED
|
@@ -84,31 +84,30 @@ with gr.Blocks() as demo:
|
|
| 84 |
submit = gr.Button("Generate Design")
|
| 85 |
output = gr.Markdown(label="Output")
|
| 86 |
|
| 87 |
-
|
| 88 |
-
"""
|
| 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 |
-
visible=False
|
| 99 |
-
)
|
| 100 |
|
| 101 |
-
def wrapper(
|
| 102 |
-
|
| 103 |
-
result = generate_software_spec(
|
| 104 |
-
spinner.update(visible=False)
|
| 105 |
-
output.update(value=result)
|
| 106 |
return result, gr.update(visible=False)
|
| 107 |
|
| 108 |
submit.click(
|
| 109 |
fn=wrapper,
|
| 110 |
inputs=[name, description, architecture, components, deployment, platform, extra],
|
| 111 |
-
outputs=[output,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 112 |
)
|
| 113 |
|
| 114 |
-
demo.launch()
|
|
|
|
| 84 |
submit = gr.Button("Generate Design")
|
| 85 |
output = gr.Markdown(label="Output")
|
| 86 |
|
| 87 |
+
status = gr.Markdown(visible=False)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 88 |
|
| 89 |
+
def wrapper(name, description, architecture, components, deployment, platform, extra):
|
| 90 |
+
status_text = "<center>⏳ Generating... Please wait.</center>"
|
| 91 |
+
result = generate_software_spec(name, description, architecture, components, deployment, platform, extra)
|
|
|
|
|
|
|
| 92 |
return result, gr.update(visible=False)
|
| 93 |
|
| 94 |
submit.click(
|
| 95 |
fn=wrapper,
|
| 96 |
inputs=[name, description, architecture, components, deployment, platform, extra],
|
| 97 |
+
outputs=[output, status],
|
| 98 |
+
preprocess=False,
|
| 99 |
+
postprocess=False,
|
| 100 |
+
show_progress=True
|
| 101 |
+
)
|
| 102 |
+
|
| 103 |
+
def show_spinner():
|
| 104 |
+
return gr.update(visible=True, value="<center>⏳ Generating... Please wait.</center>")
|
| 105 |
+
|
| 106 |
+
submit.click(
|
| 107 |
+
fn=show_spinner,
|
| 108 |
+
inputs=[],
|
| 109 |
+
outputs=[status],
|
| 110 |
+
queue=False
|
| 111 |
)
|
| 112 |
|
| 113 |
+
demo.launch()
|