File size: 1,732 Bytes
8cdf44b
 
 
 
 
 
1bb644d
8cdf44b
 
 
 
 
 
 
 
 
 
 
 
 
 
caf0b84
8cdf44b
 
 
 
 
 
 
 
 
 
4f25cd3
8cdf44b
4e02550
caf0b84
a917be6
 
4e02550
8cdf44b
 
 
 
 
 
 
 
 
 
4e02550
8cdf44b
edd082b
 
 
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
50
51
52
53
54
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}')