Update app.py
Browse files
app.py
CHANGED
|
@@ -29,6 +29,16 @@ if st.button("Get Response"):
|
|
| 29 |
if user_input:
|
| 30 |
# Query the model
|
| 31 |
output = query({"inputs": user_input})
|
| 32 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 33 |
else:
|
| 34 |
st.write("Please enter a query to get a response.")
|
|
|
|
| 29 |
if user_input:
|
| 30 |
# Query the model
|
| 31 |
output = query({"inputs": user_input})
|
| 32 |
+
|
| 33 |
+
# Print the entire output for debugging purposes
|
| 34 |
+
st.write("**API Response:**", output)
|
| 35 |
+
|
| 36 |
+
# Check the structure of the response and adjust this line accordingly
|
| 37 |
+
if 'generated_text' in output:
|
| 38 |
+
st.write(f"**Response:** {output['generated_text']}")
|
| 39 |
+
elif isinstance(output, list) and len(output) > 0:
|
| 40 |
+
st.write(f"**Response:** {output[0].get('generated_text', 'No response available.')}")
|
| 41 |
+
else:
|
| 42 |
+
st.write("**Response:** Unable to retrieve a valid response.")
|
| 43 |
else:
|
| 44 |
st.write("Please enter a query to get a response.")
|