Spaces:
Running
Running
import streamlit as st | |
import os | |
import subprocess | |
import sys | |
st.set_page_config( | |
page_title="TradingView Chart for Stock Market Analysis", | |
page_icon="📊", | |
layout="wide", | |
) | |
secure_repo = st.secrets["private_repo"] | |
git_user = st.secrets["git_usr"] | |
git_token = st.secrets["MCGtk"] | |
def core_engine_setup(): | |
repo_url = "https://<user>:<token>@github.com/<user>/<repo>.git" | |
# Replace <token> with the environment variable for your GitHub PAT | |
secure_url = repo_url.replace("<token>", git_token).replace("<user>", git_user).replace("<repo>", secure_repo) | |
# subprocess.run(f"pip install git+{secure_url}", shell=True, check=True) | |
subprocess.run(["git", "clone", secure_url]) | |
try: | |
core_engine_setup() | |
os.chdir(secure_repo) | |
print('The core engine initialized successfully!') | |
subprocess.run(f"ls -l", shell=True, check=True) | |
subprocess.run(f"pip install -r requirements.txt", shell=True, check=True) | |
from app import technical_tab | |
from authen import authorize | |
center_col = st.columns([1, 3, 1])[1] | |
with center_col: | |
# st.image('https://vnstock.site/wp-content/uploads/2023/07/vnstock-logo-120x60.jpg', width=120) | |
auth, conf = authorize.load_config() | |
auth.login() | |
if st.session_state["authentication_status"]: | |
chart_tab, account_tab = st.tabs(['Home', 'Account']) | |
with chart_tab: | |
technical_tab.render() | |
with account_tab: | |
st.write(f'Xin chào *{st.session_state["name"]}*!') | |
st.markdown('### Đăng xuất') | |
auth.logout('Đăng xuất') | |
except Exception as e: | |
st.warning('Something went wrong! Please try again!') | |
print(f'Error details: {e}') |