| import gradio as gr |
| import subprocess |
| import os |
|
|
| def chat_with_picoclaw(message, history): |
| |
| |
| try: |
| |
| 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 |
| ) |
| |
| 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)}" |
|
|
| |
| 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) |
|
|