Crypto-Analyst / app.py
menikev's picture
Update app.py
a628d0e verified
import streamlit as st
import plotly.graph_objs as go
from main import CryptoCrew
import asyncio
st.title("Crypto Analyst")
crypto = st.text_input("Enter the cryptocurrency you want to analyze:")
if st.button("Analyze"):
with st.spinner("Analyzing... This may take a few minutes."):
crypto_crew = CryptoCrew(crypto)
result = asyncio.run(crypto_crew.run_async())
# Display summary
st.subheader("Analysis Summary")
st.write(result["summary"])
# Visualize sentiment
st.subheader("Sentiment Analysis")
sentiment_data = result["sentiment"]
sentiment_categories = list(sentiment_data.keys())
sentiment_values = [1 if v == "Positive" else (-1 if v == "Negative" else 0) for v in sentiment_data.values()]
colors = ['red' if v < 0 else 'green' if v > 0 else 'gray' for v in sentiment_values]
fig = go.Figure(data=[go.Bar(
x=sentiment_categories,
y=sentiment_values,
marker_color=colors
)])
fig.update_layout(
title="Sentiment Analysis",
xaxis_title="Category",
yaxis_title="Sentiment (Negative to Positive)",
yaxis=dict(tickvals=[-1, 0, 1], ticktext=["Negative", "Neutral", "Positive"])
)
st.plotly_chart(fig)