Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -9,32 +9,30 @@ crypto = st.text_input("Enter the cryptocurrency you want to analyze:")
|
|
| 9 |
if st.button("Analyze"):
|
| 10 |
with st.spinner("Analyzing... This may take a few minutes."):
|
| 11 |
crypto_crew = CryptoCrew(crypto)
|
| 12 |
-
result = crypto_crew.run()
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
st.plotly_chart(fig)
|
|
|
|
| 9 |
if st.button("Analyze"):
|
| 10 |
with st.spinner("Analyzing... This may take a few minutes."):
|
| 11 |
crypto_crew = CryptoCrew(crypto)
|
| 12 |
+
result = crypto_crew.run() # This now runs the synchronous wrapper method
|
| 13 |
+
|
| 14 |
+
# Display summary
|
| 15 |
+
st.subheader("Analysis Summary")
|
| 16 |
+
st.write(result["summary"])
|
| 17 |
+
|
| 18 |
+
# Visualize sentiment
|
| 19 |
+
st.subheader("Sentiment Analysis")
|
| 20 |
+
sentiment_data = result["sentiment"]
|
| 21 |
+
sentiment_categories = list(sentiment_data.keys())
|
| 22 |
+
sentiment_values = [1 if v == "Positive" else (-1 if v == "Negative" else 0) for v in sentiment_data.values()]
|
| 23 |
+
colors = ['red' if v < 0 else 'green' if v > 0 else 'gray' for v in sentiment_values]
|
| 24 |
+
|
| 25 |
+
fig = go.Figure(data=[go.Bar(
|
| 26 |
+
x=sentiment_categories,
|
| 27 |
+
y=sentiment_values,
|
| 28 |
+
marker_color=colors
|
| 29 |
+
)])
|
| 30 |
+
|
| 31 |
+
fig.update_layout(
|
| 32 |
+
title="Sentiment Analysis",
|
| 33 |
+
xaxis_title="Category",
|
| 34 |
+
yaxis_title="Sentiment (Negative to Positive)",
|
| 35 |
+
yaxis=dict(tickvals=[-1, 0, 1], ticktext=["Negative", "Neutral", "Positive"])
|
| 36 |
+
)
|
| 37 |
+
|
| 38 |
+
st.plotly_chart(fig)
|
|
|
|
|
|