THED1 commited on
Commit
576c5a1
·
verified ·
1 Parent(s): 2ae51a0

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +26 -0
app.py ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ import subprocess
3
+
4
+ def ask_ai(prompt):
5
+ # OpenClaw ko call karein (command adjust karein agar jaroori ho)
6
+ try:
7
+ # Example: "openclaw run <prompt>"
8
+ result = subprocess.run(
9
+ ["openclaw", "run", prompt],
10
+ capture_output=True,
11
+ text=True,
12
+ timeout=120
13
+ )
14
+ return result.stdout or result.stderr
15
+ except Exception as e:
16
+ return f"Error: {str(e)}"
17
+
18
+ iface = gr.Interface(
19
+ fn=ask_ai,
20
+ inputs=gr.Textbox(label="Prompt", placeholder="Kuchh bhi puchhiye..."),
21
+ outputs=gr.Textbox(label="OpenClaw Response"),
22
+ title="OpenClaw AI",
23
+ description="Ye Space OpenClaw + sabhi tools ke saath ready hai."
24
+ )
25
+
26
+ iface.launch(server_name="0.0.0.0", server_port=7860)