Spaces:
Runtime error
Runtime error
Update pages/Comparision.py
Browse files- pages/Comparision.py +17 -5
pages/Comparision.py
CHANGED
|
@@ -103,24 +103,36 @@ if st.button("Start Analysis"):
|
|
| 103 |
sentiment_score_transformer, sentiment_label_transformer, summary_transformer = future_transformer.result()
|
| 104 |
sentiment_score_llama, sentiment_label_llama, summary_llama = future_llama.result()
|
| 105 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 106 |
# Display results for Transformers-based analysis in the first column
|
| 107 |
with col1:
|
| 108 |
st.subheader("Transformers Analysis")
|
| 109 |
with st.expander("Sentiment Analysis - Transformers"):
|
| 110 |
sentiment_emoji = 'π' if sentiment_label_transformer == 'POSITIVE' else 'π'
|
| 111 |
st.write(f"Sentiment: {sentiment_label_transformer} ({sentiment_emoji})")
|
| 112 |
-
st.write(f"Score: {sentiment_score_transformer
|
| 113 |
-
|
| 114 |
with st.expander("Summarization - Transformers"):
|
| 115 |
st.write(summary_transformer)
|
| 116 |
-
|
| 117 |
# Display results for Llama-based analysis in the second column
|
| 118 |
with col2:
|
| 119 |
st.subheader("Llama Analysis")
|
| 120 |
with st.expander("Sentiment Analysis - Llama"):
|
| 121 |
sentiment_emoji = 'π' if sentiment_label_llama == 'POSITIVE' else 'π'
|
| 122 |
st.write(f"Sentiment: {sentiment_label_llama} ({sentiment_emoji})")
|
| 123 |
-
st.write(f"Score: {sentiment_score_llama
|
| 124 |
-
|
| 125 |
with st.expander("Summarization - Llama"):
|
| 126 |
st.write(summary_llama)
|
|
|
|
| 103 |
sentiment_score_transformer, sentiment_label_transformer, summary_transformer = future_transformer.result()
|
| 104 |
sentiment_score_llama, sentiment_label_llama, summary_llama = future_llama.result()
|
| 105 |
|
| 106 |
+
|
| 107 |
+
|
| 108 |
+
|
| 109 |
+
# Ensure that the score is properly handled as a float, or display the string as-is
|
| 110 |
+
def display_score(score):
|
| 111 |
+
try:
|
| 112 |
+
# Attempt to format as float if it's a valid number
|
| 113 |
+
return f"{float(score):.2f}"
|
| 114 |
+
except ValueError:
|
| 115 |
+
# If it's not a number, just return the score as is (probably a string error message)
|
| 116 |
+
return score
|
| 117 |
+
|
| 118 |
# Display results for Transformers-based analysis in the first column
|
| 119 |
with col1:
|
| 120 |
st.subheader("Transformers Analysis")
|
| 121 |
with st.expander("Sentiment Analysis - Transformers"):
|
| 122 |
sentiment_emoji = 'π' if sentiment_label_transformer == 'POSITIVE' else 'π'
|
| 123 |
st.write(f"Sentiment: {sentiment_label_transformer} ({sentiment_emoji})")
|
| 124 |
+
st.write(f"Score: {display_score(sentiment_score_transformer)}") # Use the display_score function
|
| 125 |
+
|
| 126 |
with st.expander("Summarization - Transformers"):
|
| 127 |
st.write(summary_transformer)
|
| 128 |
+
|
| 129 |
# Display results for Llama-based analysis in the second column
|
| 130 |
with col2:
|
| 131 |
st.subheader("Llama Analysis")
|
| 132 |
with st.expander("Sentiment Analysis - Llama"):
|
| 133 |
sentiment_emoji = 'π' if sentiment_label_llama == 'POSITIVE' else 'π'
|
| 134 |
st.write(f"Sentiment: {sentiment_label_llama} ({sentiment_emoji})")
|
| 135 |
+
st.write(f"Score: {display_score(sentiment_score_llama)}") # Use the display_score function
|
| 136 |
+
|
| 137 |
with st.expander("Summarization - Llama"):
|
| 138 |
st.write(summary_llama)
|