Luis123321 commited on
Commit
781a1e2
·
verified ·
1 Parent(s): 3c6bf88

Create App.

Browse files
Files changed (1) hide show
  1. App. +38 -0
App. ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ import subprocess
3
+ import os
4
+
5
+ def chat_with_picoclaw(message, history):
6
+ # Hier wird der Befehl an Picoclaw gesendet
7
+ # Wir nutzen 'sh -c' um sicherzustellen, dass Pfade stimmen
8
+ try:
9
+ # Debug: Prüfen ob Binary da ist
10
+ if not os.path.exists("./picoclaw"):
11
+ return "Fehler: picoclaw Binary nicht gefunden!"
12
+
13
+ result = subprocess.run(
14
+ ["./picoclaw", "agent", "-m", message],
15
+ capture_output=True,
16
+ text=True,
17
+ timeout=120 # Längeres Timeout für KI-Denkzeit
18
+ )
19
+
20
+ if result.returncode != 0:
21
+ return f"Fehler (Code {result.returncode}): {result.stderr}"
22
+
23
+ return result.stdout.strip()
24
+
25
+ except Exception as e:
26
+ return f"System-Fehler: {str(e)}"
27
+
28
+ # Die Oberfläche bauen
29
+ demo = gr.ChatInterface(
30
+ fn=chat_with_picoclaw,
31
+ title="🦞 PicoClaw Mobile",
32
+ description="Dein KI-Agent. Tippe einen Befehl oder eine Frage.",
33
+ examples=["Wer bist du?", "Was kannst du?", "Liste deine Skills"],
34
+ type="messages"
35
+ )
36
+
37
+ if __name__ == "__main__":
38
+ demo.launch(server_name="0.0.0.0", server_port=7860)