-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.py
49 lines (39 loc) · 1.48 KB
/
app.py
1
2
3
4
5
6
7
8
9
10
11
12
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
39
40
41
42
43
44
45
46
47
48
49
import streamlit as st
import pickle
import gdown
# Modules
from FinPredictorX.utils.about import explainAboutApp
from FinPredictorX.price import price
# Download gdown file
@st.cache_resource
def load_models():
gdown.download(f"https://drive.google.com/uc?id={st.secrets['INDIAN_COMPANIES']}", 'indian_companies.pkl', quiet=False)
gdown.download(f"https://drive.google.com/uc?id={st.secrets['CRYPTO_CURRENCIES']}", 'crypto_currencies.pkl', quiet=False)
stock_files = {
"Indian Companies": "indian_companies.pkl",
"Cryptocurrency": "crypto_currencies.pkl"
}
features = {
"Price Prediction": price
}
def finPredictorX(feature: str):
choice = st.sidebar.radio("Select your choice", ["About"] + list(stock_files.keys()))
if choice == "About":
explainAboutApp(feature=feature)
return
# Load the coins/stocks dataset
with open(stock_files[choice], "rb") as file:
stocks = pickle.load(file)
selected_db = st.sidebar.selectbox(f"Select the {choice}", stocks)
# Display the selected dataset
chosen_feature_func = features[feature]
chosen_feature_func(stocks[selected_db])
if __name__ == '__main__':
st.title("🌟 Welcome to FinPredictorX App")
st.sidebar.title("FinPredictorX App")
load_models()
feature = st.sidebar.radio("Select the Prediction Type", features.keys())
if feature:
finPredictorX(feature=feature)
else:
st.sidebar.warning("Select a dataset to start the application!", icon="⚠️")