PD03 commited on
Commit
0675905
·
verified ·
1 Parent(s): e2848a2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -5
app.py CHANGED
@@ -3,9 +3,11 @@ import requests, json, re
3
 
4
  MCP_URL = "https://pretty-areas-make.loca.lt/mcp"
5
 
 
 
 
6
  def query_llm(prompt):
7
- url = "https://huggingface-projects-falcon-7b-instruct.hf.space/run/predict"
8
- response = requests.post(url, json={"data": [prompt]})
9
 
10
  if response.status_code == 200:
11
  result = response.json()
@@ -15,8 +17,8 @@ def query_llm(prompt):
15
 
16
  def extract_query_params(query):
17
  prompt = f"""
18
- Extract date and quantity from the sentence '{query}'.
19
- Respond only in JSON format:
20
  {{"date_from":"YYYY-MM-DD","min_quantity":number}}
21
  """
22
  llm_response = query_llm(prompt)
@@ -58,7 +60,7 @@ iface = gr.Interface(
58
  fn=agent_query,
59
  inputs="text",
60
  outputs="text",
61
- title="Dynamic MCP Agent for SAP (Free Falcon LLM)",
62
  description="Ask SAP queries naturally, e.g., 'Orders after 2023-04-01 with at least 10 units.'"
63
  )
64
 
 
3
 
4
  MCP_URL = "https://pretty-areas-make.loca.lt/mcp"
5
 
6
+ # Verified public endpoint for Falcon-7B-Instruct
7
+ API_URL = "https://falcon-7b-instruct-demo.hf.space/run/predict"
8
+
9
  def query_llm(prompt):
10
+ response = requests.post(API_URL, json={"data": [prompt]})
 
11
 
12
  if response.status_code == 200:
13
  result = response.json()
 
17
 
18
  def extract_query_params(query):
19
  prompt = f"""
20
+ Extract date and quantity from '{query}'.
21
+ Return ONLY JSON:
22
  {{"date_from":"YYYY-MM-DD","min_quantity":number}}
23
  """
24
  llm_response = query_llm(prompt)
 
60
  fn=agent_query,
61
  inputs="text",
62
  outputs="text",
63
+ title="Dynamic MCP Agent for SAP (Public Falcon LLM)",
64
  description="Ask SAP queries naturally, e.g., 'Orders after 2023-04-01 with at least 10 units.'"
65
  )
66