Spaces:
Running
Running
James McCool
commited on
Commit
·
1021da9
1
Parent(s):
f66989a
Initial commit
Browse files- app.py +68 -0
- app.yaml +10 -0
- requirements.txt +10 -0
app.py
ADDED
@@ -0,0 +1,68 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
st.set_page_config(layout="wide")
|
3 |
+
|
4 |
+
for name in dir():
|
5 |
+
if not name.startswith('_'):
|
6 |
+
del globals()[name]
|
7 |
+
|
8 |
+
import numpy as np
|
9 |
+
import pandas as pd
|
10 |
+
import streamlit as st
|
11 |
+
import gspread
|
12 |
+
import pymongo
|
13 |
+
|
14 |
+
@st.cache_resource
|
15 |
+
def init_conn():
|
16 |
+
uri = st.secrets['mongo_uri']
|
17 |
+
client = pymongo.MongoClient(uri, retryWrites=True, serverSelectionTimeoutMS=500000)
|
18 |
+
db = client["MLB_Database"]
|
19 |
+
|
20 |
+
return db
|
21 |
+
|
22 |
+
# db = init_conn()
|
23 |
+
|
24 |
+
player_roo_format = {'Top_finish': '{:.2%}','Top_5_finish': '{:.2%}', 'Top_10_finish': '{:.2%}', '20+%': '{:.2%}', '2x%': '{:.2%}', '3x%': '{:.2%}',
|
25 |
+
'4x%': '{:.2%}'}
|
26 |
+
|
27 |
+
st.markdown("""
|
28 |
+
<style>
|
29 |
+
/* Tab styling */
|
30 |
+
.stTabs [data-baseweb="tab-list"] {
|
31 |
+
gap: 8px;
|
32 |
+
padding: 4px;
|
33 |
+
}
|
34 |
+
.stTabs [data-baseweb="tab"] {
|
35 |
+
height: 50px;
|
36 |
+
white-space: pre-wrap;
|
37 |
+
background-color: #DAA520;
|
38 |
+
color: white;
|
39 |
+
border-radius: 10px;
|
40 |
+
gap: 1px;
|
41 |
+
padding: 10px 20px;
|
42 |
+
font-weight: bold;
|
43 |
+
transition: all 0.3s ease;
|
44 |
+
}
|
45 |
+
.stTabs [aria-selected="true"] {
|
46 |
+
background-color: #DAA520;
|
47 |
+
border: 3px solid #FFD700;
|
48 |
+
color: white;
|
49 |
+
}
|
50 |
+
.stTabs [data-baseweb="tab"]:hover {
|
51 |
+
background-color: #FFD700;
|
52 |
+
cursor: pointer;
|
53 |
+
}
|
54 |
+
</style>""", unsafe_allow_html=True)
|
55 |
+
|
56 |
+
tab1, tab2, tab3 = st.tabs(["Scoring Percentages", "Player ROO", "Optimals"])
|
57 |
+
|
58 |
+
with tab1:
|
59 |
+
st.title("Scoring Percentages")
|
60 |
+
st.write("This is the scoring percentages tab.")
|
61 |
+
|
62 |
+
with tab2:
|
63 |
+
st.title("Player ROO")
|
64 |
+
st.write("This is the player ROO tab.")
|
65 |
+
|
66 |
+
with tab3:
|
67 |
+
st.title("Optimals")
|
68 |
+
st.write("This is the optimals tab.")
|
app.yaml
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
runtime: python
|
2 |
+
env: flex
|
3 |
+
|
4 |
+
runtime_config:
|
5 |
+
python_version: 3
|
6 |
+
|
7 |
+
entrypoint: streamlit run streamlit-app.py --server.port $PORT
|
8 |
+
|
9 |
+
automatic_scaling:
|
10 |
+
max_num_instances: 200
|
requirements.txt
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
streamlit
|
2 |
+
gspread
|
3 |
+
openpyxl
|
4 |
+
matplotlib
|
5 |
+
streamlit-aggrid
|
6 |
+
pulp
|
7 |
+
docker
|
8 |
+
plotly
|
9 |
+
scipy
|
10 |
+
pymongo
|