Spaces:
Sleeping
Sleeping
Update app.py
Browse files
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 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
# implement the flask call here
|
17 |
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
|
|
|
|
|
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}")
|