Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,18 +1,25 @@
|
|
| 1 |
-
from transformers import pipeline
|
| 2 |
import gradio as gr
|
|
|
|
| 3 |
|
| 4 |
-
|
|
|
|
|
|
|
| 5 |
|
| 6 |
def reason(query):
|
| 7 |
-
|
| 8 |
-
query,
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 16 |
|
| 17 |
-
iface = gr.Interface(fn=reason, inputs="text", outputs="text", title="AEGIS Reasoner")
|
| 18 |
iface.launch()
|
|
|
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
+
import requests
|
| 3 |
|
| 4 |
+
# 🌐 Change this to your backend URL:
|
| 5 |
+
BACKEND_URL = "http://localhost:8080/reason" # if local
|
| 6 |
+
# Or if deployed: "https://<your-backend-url>/reason"
|
| 7 |
|
| 8 |
def reason(query):
|
| 9 |
+
try:
|
| 10 |
+
response = requests.post(BACKEND_URL, json={"query": query}, timeout=60)
|
| 11 |
+
response.raise_for_status()
|
| 12 |
+
data = response.json()
|
| 13 |
+
return data.get("response", "⚠️ No response field in backend reply")
|
| 14 |
+
except Exception as e:
|
| 15 |
+
return f"⚠️ Error contacting backend: {e}"
|
| 16 |
+
|
| 17 |
+
iface = gr.Interface(
|
| 18 |
+
fn=reason,
|
| 19 |
+
inputs=gr.Textbox(label="Enter your research query"),
|
| 20 |
+
outputs="text",
|
| 21 |
+
title="AEGIS Agentic Reasoner",
|
| 22 |
+
description="This interface sends your query to the AEGIS backend for reasoning."
|
| 23 |
+
)
|
| 24 |
|
|
|
|
| 25 |
iface.launch()
|