Download app.py from mgbam/robosage: direct link, hf CLI and curl.
- Browser
- Download file 1.61 kB
-
https://huggingface.co/spaces/mgbam/robosage/resolve/634a8f0ecc85a59c0ed3dababa75276cca8c69f1/app.py
- Command line
-
hf download hf://spaces/mgbam/robosage@634a8f0ecc85a59c0ed3dababa75276cca8c69f1/app.py
-
curl -L -o app.py https://huggingface.co/spaces/mgbam/robosage/resolve/634a8f0ecc85a59c0ed3dababa75276cca8c69f1/app.py
1.61 kB
| # voice_to_app.py - Core Creator Logic | |
| from openai import OpenAI | |
| from core_creator.intent_parser import classify_robot_idea | |
| from core_creator.app_blueprint import generate_app_blueprint | |
| from core_creator.code_generator import generate_app_code | |
| from core_creator.assets_manager import fetch_visual_assets | |
| class VoiceToAppCreator: | |
| def __init__(self, voice_transcript: str): | |
| self.voice_input = voice_transcript | |
| self.intent = None | |
| self.blueprint = None | |
| self.generated_code = None | |
| self.assets = None | |
| def run_pipeline(self): | |
| print("\n[π] Classifying robot intent...") | |
| self.intent = classify_robot_idea(self.voice_input) | |
| print(f"[π§ ] Detected intent: {self.intent}") | |
| self.blueprint = generate_app_blueprint(self.voice_input, self.intent) | |
| print("[βοΈ] Generating code from blueprint...") | |
| self.generated_code = generate_app_code(self.blueprint) | |
| print("[π¨] Fetching visual/audio assets...") | |
| self.assets = fetch_visual_assets(self.intent) | |
| print("[β ] Robot App creation complete.") | |
| return { | |
| "intent": self.intent, | |
| "blueprint": self.blueprint, | |
| "code": self.generated_code, | |
| "assets": self.assets | |
| } | |
| # Example usage | |
| if __name__ == "__main__": | |
| user_idea = "Build a robot that teaches kids to brush their teeth with fun animations." | |
| creator = VoiceToAppCreator(user_idea) | |
| app_package = creator.run_pipeline() | |
| print("\n--- Final App Package ---") | |
| print(app_package["code"][:500]) # preview generated code | |