Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -11,28 +11,29 @@ if st.button("Analyze"):
|
|
11 |
crypto_crew = CryptoCrew(crypto)
|
12 |
result = crypto_crew.run() # This now runs the synchronous wrapper method
|
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 |
-
|
|
|
|
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.get("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 |
+
if sentiment_categories and sentiment_values:
|
26 |
+
fig = go.Figure(data=[go.Bar(
|
27 |
+
x=sentiment_categories,
|
28 |
+
y=sentiment_values,
|
29 |
+
marker_color=colors
|
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 |
+
st.plotly_chart(fig)
|
38 |
+
else:
|
39 |
+
st.write("No sentiment data available.")
|