Update app.py
Browse files
app.py
CHANGED
@@ -1,40 +1,56 @@
|
|
1 |
-
# app.py - Entry point to run RoboSage App from voice idea to deployment
|
2 |
-
|
3 |
import gradio as gr
|
4 |
import asyncio
|
5 |
from core_creator.voice_to_app import VoiceToAppCreator
|
6 |
from deployer.gradio_generator import launch_gradio_app
|
7 |
import os
|
8 |
|
9 |
-
#
|
10 |
os.environ["GEMINI_API_KEY"] = os.getenv("GEMINI_API_KEY", "")
|
11 |
os.environ["OPENAI_API_KEY"] = os.getenv("OPENAI_API_KEY", "")
|
12 |
|
13 |
async def handle_user_idea(idea: str):
|
|
|
14 |
creator = VoiceToAppCreator(idea)
|
15 |
app_assets = creator.run_pipeline()
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
)
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
38 |
|
39 |
if __name__ == "__main__":
|
40 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
import gradio as gr
|
2 |
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 API keys
|
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 handle_user_idea(idea: str):
|
12 |
+
"""Process user idea through the full pipeline"""
|
13 |
creator = VoiceToAppCreator(idea)
|
14 |
app_assets = creator.run_pipeline()
|
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 |
+
with gr.Row():
|
31 |
+
idea_input = gr.Textbox(
|
32 |
+
label="Your Robot Idea",
|
33 |
+
placeholder="e.g. A healthcare assistant robot...",
|
34 |
+
lines=3
|
35 |
+
)
|
36 |
+
|
37 |
+
with gr.Row():
|
38 |
+
launch_btn = gr.Button("Create & Deploy", variant="primary")
|
39 |
+
status_output = gr.Textbox(label="Creation Status", interactive=False)
|
40 |
+
|
41 |
+
# Event handling
|
42 |
+
launch_btn.click(
|
43 |
+
fn=lambda idea: asyncio.run(handle_user_idea(idea)),
|
44 |
+
inputs=idea_input,
|
45 |
+
outputs=status_output
|
46 |
+
)
|
47 |
+
|
48 |
+
return launcher
|
49 |
|
50 |
if __name__ == "__main__":
|
51 |
+
launcher = create_launcher_interface()
|
52 |
+
launcher.launch(
|
53 |
+
server_name="0.0.0.0",
|
54 |
+
server_port=7860,
|
55 |
+
share=False
|
56 |
+
)
|