shreyab21 commited on
Commit
c7622e7
·
verified ·
1 Parent(s): 87ac7a0

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +19 -12
app.py CHANGED
@@ -1,18 +1,25 @@
1
- from transformers import pipeline
2
  import gradio as gr
 
3
 
4
- pipe = pipeline("text2text-generation", model="google/flan-t5-base")
 
 
5
 
6
  def reason(query):
7
- response = pipe(
8
- query,
9
- max_length=120,
10
- min_length=30,
11
- temperature=0.7,
12
- top_p=0.9,
13
- do_sample=True,
14
- )[0]["generated_text"]
15
- return response
 
 
 
 
 
 
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()