Spaces:
No application file
No application file
Dmitry Beresnev
commited on
Commit
·
043c5d6
1
Parent(s):
7c97068
fix app
Browse files
app.py
CHANGED
|
@@ -1,14 +1,30 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
import subprocess
|
|
|
|
|
|
|
| 3 |
|
| 4 |
-
# Start Clawdbot in
|
| 5 |
-
subprocess.Popen([
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6 |
|
| 7 |
-
# Minimal Gradio interface
|
| 8 |
def ask_clawdbot(question):
|
| 9 |
-
#
|
| 10 |
-
|
| 11 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12 |
|
| 13 |
-
iface = gr.Interface(fn=ask_clawdbot, inputs="text", outputs="text", title="Clawdbot Demo")
|
| 14 |
iface.launch(server_name="0.0.0.0", server_port=7860)
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
import subprocess
|
| 3 |
+
import requests
|
| 4 |
+
import os
|
| 5 |
|
| 6 |
+
# Start Clawdbot gateway in background
|
| 7 |
+
subprocess.Popen([
|
| 8 |
+
"clawdbot",
|
| 9 |
+
"gateway",
|
| 10 |
+
"--port", "7860",
|
| 11 |
+
"--vault-path", "/app/vault"
|
| 12 |
+
])
|
| 13 |
|
|
|
|
| 14 |
def ask_clawdbot(question):
|
| 15 |
+
# Call your local Clawdbot API
|
| 16 |
+
try:
|
| 17 |
+
response = requests.post("http://localhost:7860/ask", json={"query": question})
|
| 18 |
+
return response.json().get("answer", "No answer")
|
| 19 |
+
except Exception as e:
|
| 20 |
+
return f"Error: {e}"
|
| 21 |
+
|
| 22 |
+
iface = gr.Interface(
|
| 23 |
+
fn=ask_clawdbot,
|
| 24 |
+
inputs="text",
|
| 25 |
+
outputs="text",
|
| 26 |
+
title="Clawdbot Demo",
|
| 27 |
+
description="Ask questions to your notes!"
|
| 28 |
+
)
|
| 29 |
|
|
|
|
| 30 |
iface.launch(server_name="0.0.0.0", server_port=7860)
|