Bofandra commited on
Commit
248dc42
·
verified ·
1 Parent(s): 3f3e2f5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +25 -26
app.py CHANGED
@@ -70,26 +70,35 @@ with gr.Blocks() as demo:
70
  gr.Markdown("## 🧠 AI Software Architecture Assistant")
71
 
72
  with gr.Row():
73
- name = gr.Textbox(label="App Name", placeholder="MyApp")
74
- description = gr.Textbox(label="Short Description", lines=2, placeholder="A system that manages online tutoring...")
 
 
 
 
 
 
 
 
75
 
76
- with gr.Row():
77
- architecture = gr.Radio(["Monolithic", "Backend-Frontend"], label="Architecture Style")
78
- deployment = gr.Radio(["Serverless", "VM"], label="Deployment Style")
79
- platform = gr.Radio(["Web App", "Mobile App"], label="Target Platform")
80
-
81
- components = gr.Textbox(label="Components & Tech Stack (e.g. Backend: Python + Flask, Frontend: React)", lines=4)
82
- extra = gr.Textbox(label="Extra Requirements (optional)", lines=2)
83
-
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
  result = generate_software_spec(name, description, architecture, components, deployment, platform, extra)
91
- return gr.update(value=result), gr.update(visible=False)
 
 
 
 
 
 
 
 
 
 
92
 
 
93
  submit.click(
94
  fn=wrapper,
95
  inputs=[name, description, architecture, components, deployment, platform, extra],
@@ -99,14 +108,4 @@ with gr.Blocks() as demo:
99
  show_progress=True
100
  )
101
 
102
- def show_spinner():
103
- return gr.update(visible=True, value="<center>⏳ Generating... Please wait.</center>")
104
-
105
- submit.click(
106
- fn=show_spinner,
107
- inputs=[],
108
- outputs=[status],
109
- queue=False
110
- )
111
-
112
- demo.launch()
 
70
  gr.Markdown("## 🧠 AI Software Architecture Assistant")
71
 
72
  with gr.Row():
73
+ with gr.Column():
74
+ name = gr.Textbox(label="App Name", placeholder="MyApp")
75
+ description = gr.Textbox(label="Short Description", lines=2, placeholder="A system that manages online tutoring...")
76
+ architecture = gr.Radio(["Monolithic", "Backend-Frontend"], label="Architecture Style")
77
+ deployment = gr.Radio(["Serverless", "VM"], label="Deployment Style")
78
+ platform = gr.Radio(["Web App", "Mobile App"], label="Target Platform")
79
+ components = gr.Textbox(label="Components & Tech Stack (e.g. Backend: Python + Flask, Frontend: React)", lines=4)
80
+ extra = gr.Textbox(label="Extra Requirements (optional)", lines=2)
81
+ submit = gr.Button("Generate Design")
82
+ status = gr.Markdown(visible=False)
83
 
84
+ with gr.Column():
85
+ output = gr.HTML(value="<div id='result'></div>", label="Output")
 
 
 
 
 
 
 
 
 
 
86
 
87
  def wrapper(name, description, architecture, components, deployment, platform, extra):
88
  result = generate_software_spec(name, description, architecture, components, deployment, platform, extra)
89
+ html_content = f"""
90
+ <div>{result}</div>
91
+ <script type='module'>
92
+ import mermaid from 'https://cdn.jsdelivr.net/npm/mermaid@10/dist/mermaid.esm.min.mjs';
93
+ mermaid.initialize({ startOnLoad: true });
94
+ </script>
95
+ """
96
+ return html_content, gr.update(visible=False)
97
+
98
+ def show_spinner():
99
+ return gr.update(visible=True, value="<center>⏳ Generating... Please wait.</center>")
100
 
101
+ submit.click(fn=show_spinner, inputs=[], outputs=[status], queue=False)
102
  submit.click(
103
  fn=wrapper,
104
  inputs=[name, description, architecture, components, deployment, platform, extra],
 
108
  show_progress=True
109
  )
110
 
111
+ demo.launch()