Omkar008 commited on
Commit
dee1216
1 Parent(s): 19a6938

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -12
app.py CHANGED
@@ -8,16 +8,17 @@ st.title("LLM-based RAG Search")
8
  query = st.text_input("Enter your query:")
9
 
10
  if st.button("Search"):
11
- # Make a POST request to the Flask API
12
- print("accessing ", "<Flask app string>", " with query ", query)
13
- api_url = "https://omkar008-api.hf.space/query"
14
- response = requests.post(api_url, json={"query": query})
15
-
16
- # implement the flask call here
17
 
18
- if response.status_code == 200:
19
- # Display the generated answer
20
- answer = response.json().get('answer', "No answer received.")
21
- st.write("Answer:", answer)
22
- else:
23
- st.error(f"Error: {response.status_code}")
 
 
 
8
  query = st.text_input("Enter your query:")
9
 
10
  if st.button("Search"):
11
+ with st.spinner("Searching and generating response..."):
12
+ # Make a POST request to the Flask API
13
+ print("accessing ", "<Flask app string>", " with query ", query)
14
+ api_url = "https://omkar008-api.hf.space/query"
15
+ response = requests.post(api_url, json={"query": query})
 
16
 
17
+ # implement the flask call here
18
+
19
+ if response.status_code == 200:
20
+ # Display the generated answer
21
+ answer = response.json().get('answer', "No answer received.")
22
+ st.write("Answer:", answer)
23
+ else:
24
+ st.error(f"Error: {response.status_code}")