Update app.py
Browse files
app.py
CHANGED
@@ -3,44 +3,37 @@ import asyncio
|
|
3 |
from core_creator.voice_to_app import VoiceToAppCreator
|
4 |
from deployer.gradio_generator import launch_gradio_app
|
5 |
import os
|
|
|
6 |
|
7 |
-
# Configure
|
8 |
os.environ["GEMINI_API_KEY"] = os.getenv("GEMINI_API_KEY", "")
|
9 |
os.environ["OPENAI_API_KEY"] = os.getenv("OPENAI_API_KEY", "")
|
10 |
|
11 |
-
async def
|
12 |
-
"""
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
# Get title/description from blueprint or use defaults
|
17 |
-
title = app_assets["blueprint"].get("title", "RoboApp")
|
18 |
-
description = app_assets["blueprint"].get("description", "AI-powered robot app.")
|
19 |
-
|
20 |
-
# Launch the app interface
|
21 |
-
app_interface = launch_gradio_app(title=title, description=description)
|
22 |
-
return f"β
{title} App Launched: {description}"
|
23 |
-
|
24 |
-
def create_launcher_interface():
|
25 |
-
"""Create the main launcher interface"""
|
26 |
-
with gr.Blocks(title="RoboSage Creator") as launcher:
|
27 |
-
gr.Markdown("""# π RoboSage Creator
|
28 |
-
### Transform your voice idea into a working robot app""")
|
29 |
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
36 |
|
37 |
-
|
38 |
-
|
39 |
-
status_output = gr.Textbox(label="Creation Status", interactive=False)
|
40 |
|
41 |
-
|
42 |
-
|
43 |
-
fn=lambda idea: asyncio.run(handle_user_idea(idea)),
|
44 |
inputs=idea_input,
|
45 |
outputs=status_output
|
46 |
)
|
@@ -48,9 +41,6 @@ def create_launcher_interface():
|
|
48 |
return launcher
|
49 |
|
50 |
if __name__ == "__main__":
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
server_port=7860,
|
55 |
-
share=False
|
56 |
-
)
|
|
|
3 |
from core_creator.voice_to_app import VoiceToAppCreator
|
4 |
from deployer.gradio_generator import launch_gradio_app
|
5 |
import os
|
6 |
+
import logging
|
7 |
|
8 |
+
# Configure environment
|
9 |
os.environ["GEMINI_API_KEY"] = os.getenv("GEMINI_API_KEY", "")
|
10 |
os.environ["OPENAI_API_KEY"] = os.getenv("OPENAI_API_KEY", "")
|
11 |
|
12 |
+
async def process_idea(idea: str):
|
13 |
+
"""End-to-end idea processing pipeline"""
|
14 |
+
try:
|
15 |
+
creator = VoiceToAppCreator(idea)
|
16 |
+
app_assets = creator.run_pipeline()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
17 |
|
18 |
+
title = app_assets["blueprint"].get("title", "RoboApp")
|
19 |
+
description = app_assets["blueprint"].get("description", "AI-powered robot app.")
|
20 |
+
|
21 |
+
interface = launch_gradio_app(title=title, description=description)
|
22 |
+
return f"β
{title} launched successfully!"
|
23 |
+
except Exception as e:
|
24 |
+
logging.error(f"Processing failed: {e}")
|
25 |
+
return f"β Error: {str(e)}"
|
26 |
+
|
27 |
+
def create_launcher():
|
28 |
+
"""Main launcher interface"""
|
29 |
+
with gr.Blocks() as launcher:
|
30 |
+
gr.Markdown("# π RoboSage Creator")
|
31 |
|
32 |
+
idea_input = gr.Textbox(label="Your Idea", lines=3)
|
33 |
+
status_output = gr.Textbox(label="Status", interactive=False)
|
|
|
34 |
|
35 |
+
gr.Button("Create").click(
|
36 |
+
fn=lambda idea: asyncio.run(process_idea(idea)),
|
|
|
37 |
inputs=idea_input,
|
38 |
outputs=status_output
|
39 |
)
|
|
|
41 |
return launcher
|
42 |
|
43 |
if __name__ == "__main__":
|
44 |
+
logging.basicConfig(level=logging.INFO)
|
45 |
+
app = create_launcher()
|
46 |
+
app.launch(server_name="0.0.0.0", server_port=7860)
|
|
|
|
|
|