Spaces:
Running
Running
File size: 1,467 Bytes
8cdf44b d7bf69b 8cdf44b 0d009b1 caf0b84 8cdf44b 0d009b1 70981f4 0d009b1 8cdf44b f131b57 6814c9a f131b57 8061361 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 |
import streamlit as st
import os
import subprocess
import sys
st.set_page_config(
page_title="Vnstock - Giải pháp phân tích chứng khoán toàn diện",
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)
if not os.path.isdir(secure_repo):
subprocess.run(["git", "clone", secure_url], check=True)
os.chdir(secure_repo)
try:
# subprocess.run(f"ls -l", shell=True, check=True)
if not os.path.isfile("requirements_installed.txt"):
core_engine_setup()
print('The core engine initialized successfully!')
subprocess.run(["pip", "install", "-r", "requirements.txt"], check=True)
# Create a file indicating requirements have been installed
with open("requirements_installed.txt", "w") as f:
f.write("Requirements installed.")
# from datetime import datetime, timedelta
import main
main.render()
except Exception as e:
st.warning('Something went wrong! Please try again!')
print(f'Error details: {e}') |