Skip to content

Commit

Permalink
Testing streamlit deploy
Browse files Browse the repository at this point in the history
  • Loading branch information
wleong1 committed Apr 7, 2024
1 parent 9b46591 commit 5908db9
Show file tree
Hide file tree
Showing 2 changed files with 87 additions and 1 deletion.
42 changes: 41 additions & 1 deletion requirements.txt
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,42 +1,80 @@
altair==5.3.0
appdirs==1.4.4
asgiref==3.7.2
attrs==23.2.0
beautifulsoup4==4.12.3
blinker==1.7.0
cachetools==5.3.3
certifi==2023.5.7
charset-normalizer==3.1.0
click==8.1.7
contourpy==1.2.0
coverage==7.4.3
cycler==0.12.1
Django==4.1.12
django-admin-volt==1.0.10
exceptiongroup==1.1.1
Flask==3.0.2
fonttools==4.50.0
frozendict==2.4.0
gitdb==4.0.11
GitPython==3.1.43
gunicorn==21.2.0
html5lib==1.1
idna==3.4
iniconfig==2.0.0
install==1.3.5
itsdangerous==2.1.2
Jinja2==3.1.3
jmespath==1.0.1
jsonschema==4.21.1
jsonschema-specifications==2023.12.1
kiwisolver==1.4.5
lxml==4.9.3
markdown-it-py==3.0.0
MarkupSafe==2.1.5
matplotlib==3.8.3
mdurl==0.1.2
multitasking==0.0.11
mypy==1.8.0
mypy-extensions==1.0.0
numpy==1.26.4
packaging==23.1
pandas==2.2.1
pandas-stubs==2.2.0.240218
patsy==0.5.6
peewee==3.17.1
pillow==10.2.0
plotly==5.20.0
pluggy==1.0.0
psycopg2==2.9.9
protobuf==4.25.3
psycopg2-binary==2.9.9
pyarrow==15.0.2
pydeck==0.8.1b0
Pygments==2.17.2
pyparsing==3.1.2
pytest==7.3.1
pytest-cov==4.1.0
python-dateutil==2.8.2
python-dotenv==1.0.0
pytz==2023.3
referencing==0.34.0
requests==2.31.0
rich==13.7.1
rpds-py==0.18.0
ruff==0.3.0
scipy==1.13.0
six==1.16.0
smmap==5.0.1
soupsieve==2.5
sqlparse==0.4.4
statsmodels==0.14.1
streamlit==1.33.0
tenacity==8.2.3
toml==0.10.2
tomli==2.0.1
toolz==0.12.1
tornado==6.4
types-openpyxl==3.1.0.20240301
types-psycopg2==2.9.21.20240311
types-pytz==2024.1.0.20240203
Expand All @@ -45,6 +83,8 @@ typing_extensions==4.8.0
tzdata==2023.3
urllib3==2.0.2
utils==1.0.1
watchdog==4.0.0
webencodings==0.5.1
Werkzeug==3.0.2
whitenoise==6.5.0
yfinance==0.2.37
46 changes: 46 additions & 0 deletions streamlit_app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
"""This module configures the streamlit web app."""
import json
import requests
import plotly.express as px # type: ignore[import-untyped] # pylint: disable=E0401
import pandas as pd
import streamlit as st # type: ignore[import-untyped] # pylint: disable=E0401


company_list_response: requests.Response = requests.get(
"http://core-modules:5000/model/generate_company_list"
)
company_list: list = company_list_response.json()
st.write("Hello, let's learn more about a company together!")
company = st.selectbox("Pick a company", [None] + company_list)
st.write("You selected:", company)

if company:
payload: dict = {"company": company}
update_response: requests.Response = requests.post(
"http://core-modules:5000/update_data", json=payload
)
price: float = update_response.json()["price"]
news: list = update_response.json()["news"]
st.sidebar.write(f"{company}'s most recent price: {price}")

news_container = st.sidebar.container()
for article in news:
news_container.markdown(f"- [{article['title']}]({article['url']})")

chart_data: dict = json.loads(update_response.json()["graph"])
date: dict
close: dict
date, close = chart_data["date"].values(), chart_data["close"].values()
df = pd.DataFrame(close, date)

fig = px.line(df)

fig.update_layout(
title=company,
xaxis_title='Date',
yaxis_title='Close',
width=800,
height=600
)

st.plotly_chart(fig)

0 comments on commit 5908db9

Please sign in to comment.