Update app.py
Browse files
app.py
CHANGED
@@ -1,45 +1,40 @@
|
|
1 |
-
#
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
from core_creator.
|
6 |
-
from
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
# Example usage
|
39 |
-
if __name__ == "__main__":
|
40 |
-
user_idea = "Build a robot that teaches kids to brush their teeth with fun animations."
|
41 |
-
creator = VoiceToAppCreator(user_idea)
|
42 |
-
app_package = creator.run_pipeline()
|
43 |
|
44 |
-
|
45 |
-
|
|
|
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 |
+
# Optional: configure Gemini/OpenAI keys before launch if needed
|
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 |
+
app_ui = launch_gradio_app(
|
17 |
+
title=app_assets["blueprint"].get("title", "RoboApp"),
|
18 |
+
description=app_assets["blueprint"].get("description", "AI-powered robot app.")
|
19 |
+
)
|
20 |
+
app_ui.launch(share=True)
|
21 |
+
return "β
App Launched"
|
22 |
+
|
23 |
+
def run_app():
|
24 |
+
with gr.Blocks() as demo:
|
25 |
+
gr.Markdown("""# π RoboSage: Create Your Own Robot App from Voice
|
26 |
+
Speak or type your robot idea and weβll generate, simulate, and deploy it live.
|
27 |
+
""")
|
28 |
+
user_idea = gr.Textbox(label="Your Robot Idea", placeholder="e.g. A robot that reminds me to hydrate.")
|
29 |
+
out = gr.Textbox(label="Status")
|
30 |
+
launch_btn = gr.Button("Create & Deploy")
|
31 |
+
|
32 |
+
def run_async(idea):
|
33 |
+
return asyncio.run(handle_user_idea(idea))
|
34 |
+
|
35 |
+
launch_btn.click(fn=run_async, inputs=user_idea, outputs=out)
|
36 |
+
|
37 |
+
demo.launch()
|
|
|
|
|
|
|
|
|
|
|
38 |
|
39 |
+
if __name__ == "__main__":
|
40 |
+
run_app()
|