Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,40 +1,40 @@
|
|
| 1 |
-
import streamlit as st
|
| 2 |
-
import plotly.graph_objs as go
|
| 3 |
-
from main import CryptoCrew
|
| 4 |
-
|
| 5 |
-
st.title("Crypto Analysis and Coaching")
|
| 6 |
-
|
| 7 |
-
crypto = st.text_input("Enter the cryptocurrency you want to analyze:")
|
| 8 |
-
|
| 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 |
-
# Display summary
|
| 15 |
-
st.subheader("Analysis Summary")
|
| 16 |
-
st.write(result["summary"])
|
| 17 |
-
|
| 18 |
-
# Visualize sentiment
|
| 19 |
-
st.subheader("Sentiment Analysis")
|
| 20 |
-
|
| 21 |
-
sentiment_data = result["sentiment"]
|
| 22 |
-
sentiment_categories = list(sentiment_data.keys())
|
| 23 |
-
sentiment_values = [1 if v == "Positive" else (-1 if v == "Negative" else 0) for v in sentiment_data.values()]
|
| 24 |
-
|
| 25 |
-
colors = ['red' if v < 0 else 'green' if v > 0 else 'gray' for v in sentiment_values]
|
| 26 |
-
|
| 27 |
-
fig = go.Figure(data=[go.Bar(
|
| 28 |
-
x=sentiment_categories,
|
| 29 |
-
y=sentiment_values,
|
| 30 |
-
marker_color=colors
|
| 31 |
-
)])
|
| 32 |
-
|
| 33 |
-
fig.update_layout(
|
| 34 |
-
title="Sentiment Analysis",
|
| 35 |
-
xaxis_title="Category",
|
| 36 |
-
yaxis_title="Sentiment (Negative to Positive)",
|
| 37 |
-
yaxis=dict(tickvals=[-1, 0, 1], ticktext=["Negative", "Neutral", "Positive"])
|
| 38 |
-
)
|
| 39 |
-
|
| 40 |
st.plotly_chart(fig)
|
|
|
|
| 1 |
+
import streamlit as st
|
| 2 |
+
import plotly.graph_objs as go
|
| 3 |
+
from main import CryptoCrew
|
| 4 |
+
|
| 5 |
+
st.title("Crypto Analysis and Coaching")
|
| 6 |
+
|
| 7 |
+
crypto = st.text_input("Enter the cryptocurrency you want to analyze:")
|
| 8 |
+
|
| 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 |
+
# Display summary
|
| 15 |
+
st.subheader("Analysis Summary")
|
| 16 |
+
st.write(result["summary"])
|
| 17 |
+
|
| 18 |
+
# Visualize sentiment
|
| 19 |
+
st.subheader("Sentiment Analysis")
|
| 20 |
+
|
| 21 |
+
sentiment_data = result["sentiment"]
|
| 22 |
+
sentiment_categories = list(sentiment_data.keys())
|
| 23 |
+
sentiment_values = [1 if v == "Positive" else (-1 if v == "Negative" else 0) for v in sentiment_data.values()]
|
| 24 |
+
|
| 25 |
+
colors = ['red' if v < 0 else 'green' if v > 0 else 'gray' for v in sentiment_values]
|
| 26 |
+
|
| 27 |
+
fig = go.Figure(data=[go.Bar(
|
| 28 |
+
x=sentiment_categories,
|
| 29 |
+
y=sentiment_values,
|
| 30 |
+
marker_color=colors
|
| 31 |
+
)])
|
| 32 |
+
|
| 33 |
+
fig.update_layout(
|
| 34 |
+
title="Sentiment Analysis",
|
| 35 |
+
xaxis_title="Category",
|
| 36 |
+
yaxis_title="Sentiment (Negative to Positive)",
|
| 37 |
+
yaxis=dict(tickvals=[-1, 0, 1], ticktext=["Negative", "Neutral", "Positive"])
|
| 38 |
+
)
|
| 39 |
+
|
| 40 |
st.plotly_chart(fig)
|