Update deployer/deployer.py
Browse files- deployer/deployer.py +26 -0
deployer/deployer.py
CHANGED
|
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# deployer.py - Launch pipeline for RoboSage-generated apps
|
| 2 |
+
|
| 3 |
+
from deployer.gradio_generator import launch_gradio_app
|
| 4 |
+
import datetime
|
| 5 |
+
|
| 6 |
+
class AppDeployer:
|
| 7 |
+
def __init__(self, blueprint):
|
| 8 |
+
self.title = blueprint.get("title", "Robo App")
|
| 9 |
+
self.description = blueprint.get("description", "A custom robot experience")
|
| 10 |
+
self.timestamp = datetime.datetime.now().strftime("%Y-%m-%d_%H-%M-%S")
|
| 11 |
+
self.launch_id = f"{self.title.replace(' ', '_')}_{self.timestamp}"
|
| 12 |
+
|
| 13 |
+
def deploy(self):
|
| 14 |
+
print(f"[🚀] Deploying: {self.title} ({self.launch_id})")
|
| 15 |
+
app = launch_gradio_app(self.title, self.description)
|
| 16 |
+
app.launch(share=True)
|
| 17 |
+
print("[✅] App launched on Hugging Face!")
|
| 18 |
+
|
| 19 |
+
# Example
|
| 20 |
+
if __name__ == "__main__":
|
| 21 |
+
test_blueprint = {
|
| 22 |
+
"title": "GreeterBot",
|
| 23 |
+
"description": "Waves hello and greets users at your shop entrance."
|
| 24 |
+
}
|
| 25 |
+
deployer = AppDeployer(test_blueprint)
|
| 26 |
+
deployer.deploy()
|