Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -45,16 +45,23 @@ if st.button("Analyze"):
|
|
| 45 |
# Extract M and T values
|
| 46 |
M = analyze_data[0]["M"]
|
| 47 |
T = analyze_data[0]["T"]
|
| 48 |
-
|
| 49 |
# Display traffic light system
|
| 50 |
if M == 2 and T == 2:
|
| 51 |
-
st.
|
| 52 |
elif M == 1 or T == 1:
|
| 53 |
-
st.
|
| 54 |
else:
|
| 55 |
-
st.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 56 |
except (KeyError, IndexError, ValueError) as e:
|
| 57 |
st.error(f"Error extracting analysis results: {str(e)}")
|
| 58 |
st.error("Please check the API response format and adapt the code accordingly.")
|
| 59 |
else:
|
| 60 |
-
st.warning("Please provide all inputs!")
|
|
|
|
|
|
|
|
|
| 45 |
# Extract M and T values
|
| 46 |
M = analyze_data[0]["M"]
|
| 47 |
T = analyze_data[0]["T"]
|
| 48 |
+
|
| 49 |
# Display traffic light system
|
| 50 |
if M == 2 and T == 2:
|
| 51 |
+
st.markdown("<h1 style='text-align: center; color: green;'>π’ Content is highly relevant and trustworthy</h1>", unsafe_allow_html=True)
|
| 52 |
elif M == 1 or T == 1:
|
| 53 |
+
st.markdown("<h1 style='text-align: center; color: orange;'>π‘ Content is partly relevant/helpful</h1>", unsafe_allow_html=True)
|
| 54 |
else:
|
| 55 |
+
st.markdown("<h1 style='text-align: center; color: red;'>π΄ Content is not relevant</h1>", unsafe_allow_html=True)
|
| 56 |
+
|
| 57 |
+
# Display JSON response below the traffic light
|
| 58 |
+
st.subheader("JSON Response:")
|
| 59 |
+
st.json(response)
|
| 60 |
+
|
| 61 |
except (KeyError, IndexError, ValueError) as e:
|
| 62 |
st.error(f"Error extracting analysis results: {str(e)}")
|
| 63 |
st.error("Please check the API response format and adapt the code accordingly.")
|
| 64 |
else:
|
| 65 |
+
st.warning("Please provide all inputs!")
|
| 66 |
+
|
| 67 |
+
|