Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -17,7 +17,11 @@ def run_app(user_input, enhance_prompt, action, state):
|
|
| 17 |
code_bundle = enhanced
|
| 18 |
|
| 19 |
zip_bytes = save_as_zip(code_bundle)
|
| 20 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 21 |
|
| 22 |
with gr.Blocks(title="Auto App Builder") as iface:
|
| 23 |
gr.Markdown("# ⚡ Auto App Builder (Gemini Powered)\n_Powered by Google Gemini API_")
|
|
@@ -26,16 +30,16 @@ with gr.Blocks(title="Auto App Builder") as iface:
|
|
| 26 |
inp = gr.Textbox(label="App Idea", placeholder="e.g. Inventory system with login", lines=2)
|
| 27 |
btn = gr.Button("Generate App")
|
| 28 |
|
| 29 |
-
code_out = gr.Code(label="Generated Code")
|
| 30 |
|
| 31 |
enh = gr.Textbox(label="Enhancement Prompt", placeholder="Add PDF export, auth, dashboard, etc.", lines=1)
|
| 32 |
btn_enh = gr.Button("Enhance")
|
| 33 |
|
| 34 |
-
|
| 35 |
|
| 36 |
state = gr.State()
|
| 37 |
|
| 38 |
-
btn.click(fn=run_app, inputs=[inp, enh, gr.State(""), state], outputs=[code_out,
|
| 39 |
-
btn_enh.click(fn=run_app, inputs=[inp, enh, gr.State("Enhance"), state], outputs=[code_out,
|
| 40 |
|
| 41 |
iface.launch(auth=True)
|
|
|
|
| 17 |
code_bundle = enhanced
|
| 18 |
|
| 19 |
zip_bytes = save_as_zip(code_bundle)
|
| 20 |
+
|
| 21 |
+
with open("generated_app.zip", "wb") as f:
|
| 22 |
+
f.write(zip_bytes)
|
| 23 |
+
|
| 24 |
+
return code_bundle["full_code"], "generated_app.zip", state
|
| 25 |
|
| 26 |
with gr.Blocks(title="Auto App Builder") as iface:
|
| 27 |
gr.Markdown("# ⚡ Auto App Builder (Gemini Powered)\n_Powered by Google Gemini API_")
|
|
|
|
| 30 |
inp = gr.Textbox(label="App Idea", placeholder="e.g. Inventory system with login", lines=2)
|
| 31 |
btn = gr.Button("Generate App")
|
| 32 |
|
| 33 |
+
code_out = gr.Code(label="Generated Code")
|
| 34 |
|
| 35 |
enh = gr.Textbox(label="Enhancement Prompt", placeholder="Add PDF export, auth, dashboard, etc.", lines=1)
|
| 36 |
btn_enh = gr.Button("Enhance")
|
| 37 |
|
| 38 |
+
zip_file = gr.File(label="⬇️ Download Generated App", interactive=True)
|
| 39 |
|
| 40 |
state = gr.State()
|
| 41 |
|
| 42 |
+
btn.click(fn=run_app, inputs=[inp, enh, gr.State(""), state], outputs=[code_out, zip_file, state])
|
| 43 |
+
btn_enh.click(fn=run_app, inputs=[inp, enh, gr.State("Enhance"), state], outputs=[code_out, zip_file, state])
|
| 44 |
|
| 45 |
iface.launch(auth=True)
|