Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -47,20 +47,20 @@ def chat():
|
|
| 47 |
data = request.get_json()
|
| 48 |
user_query = data['user_question']
|
| 49 |
if user_query !="" and not user_query.strip().isspace() and not user_query == "" and not user_query.strip() == "" and not user_query.isspace():
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
|
| 64 |
|
| 65 |
#initial_response = llm_chain.run(user_query)
|
| 66 |
#return jsonify({'response': initial_response})
|
|
|
|
| 47 |
data = request.get_json()
|
| 48 |
user_query = data['user_question']
|
| 49 |
if user_query !="" and not user_query.strip().isspace() and not user_query == "" and not user_query.strip() == "" and not user_query.isspace():
|
| 50 |
+
try:
|
| 51 |
+
loader = WebBaseLoader(user_query)
|
| 52 |
+
with st.spinner("AI Thinking...Please wait a while to Cheers!"):
|
| 53 |
+
docs = loader.load()
|
| 54 |
+
result=chain.run(docs)
|
| 55 |
+
print(user_query)
|
| 56 |
+
print("AI Summarization: "+result)
|
| 57 |
+
#st.write("AI Summarization:")
|
| 58 |
+
#st.write(result)
|
| 59 |
+
return jsonify({'response': result})
|
| 60 |
+
except Exception as e:
|
| 61 |
+
#st.write("Wrong URL or URL not parsable.")
|
| 62 |
+
err_msg="Wrong URL or URL not parsable."
|
| 63 |
+
return jsonify({'response': err_msg})
|
| 64 |
|
| 65 |
#initial_response = llm_chain.run(user_query)
|
| 66 |
#return jsonify({'response': initial_response})
|