Spaces:
Sleeping
Sleeping
| import gradio as gr | |
| import subprocess | |
| import os | |
| def chat_with_picoclaw(message, history): | |
| # Hier wird der Befehl an Picoclaw gesendet | |
| # Wir nutzen 'sh -c' um sicherzustellen, dass Pfade stimmen | |
| try: | |
| # Debug: Prüfen ob Binary da ist | |
| if not os.path.exists("./picoclaw"): | |
| return "Fehler: picoclaw Binary nicht gefunden!" | |
| result = subprocess.run( | |
| ["./picoclaw", "agent", "-m", message], | |
| capture_output=True, | |
| text=True, | |
| timeout=120 # Längeres Timeout für KI-Denkzeit | |
| ) | |
| if result.returncode != 0: | |
| return f"Fehler (Code {result.returncode}): {result.stderr}" | |
| return result.stdout.strip() | |
| except Exception as e: | |
| return f"System-Fehler: {str(e)}" | |
| # Die Oberfläche bauen | |
| demo = gr.ChatInterface( | |
| fn=chat_with_picoclaw, | |
| title="🦞 PicoClaw Mobile", | |
| description="Dein KI-Agent. Tippe einen Befehl oder eine Frage.", | |
| examples=["Wer bist du?", "Was kannst du?", "Liste deine Skills"], | |
| type="messages" | |
| ) | |
| if __name__ == "__main__": | |
| demo.launch(server_name="0.0.0.0", server_port=7860) | |