thhung
commited on
Commit
·
41575f3
1
Parent(s):
d77ad9c
update logic
Browse files
app.py
CHANGED
|
@@ -2,6 +2,7 @@ from git import Repo
|
|
| 2 |
import os
|
| 3 |
|
| 4 |
import shutil
|
|
|
|
| 5 |
|
| 6 |
|
| 7 |
git_url = os.getenv("GIT_URL")
|
|
@@ -14,15 +15,21 @@ else:
|
|
| 14 |
print(f"Folder '{repo_dir}' does not exist.")
|
| 15 |
Repo.clone_from(git_url, repo_dir)
|
| 16 |
|
| 17 |
-
|
|
|
|
|
|
|
|
|
|
| 18 |
|
| 19 |
# Specify the folder you want to move and the current folder path
|
| 20 |
source_folder = "./my_number_temp/hnrecommender/"
|
| 21 |
-
destination_folder = os.getcwd() # Gets the path of the current
|
|
|
|
|
|
|
| 22 |
# Check if the destination folder exists and remove it if it does
|
| 23 |
-
if not os.path.exists(destination_folder):
|
| 24 |
-
|
| 25 |
-
|
|
|
|
| 26 |
|
| 27 |
import streamlit as st
|
| 28 |
|
|
|
|
| 2 |
import os
|
| 3 |
|
| 4 |
import shutil
|
| 5 |
+
from distutils.dir_util import copy_tree
|
| 6 |
|
| 7 |
|
| 8 |
git_url = os.getenv("GIT_URL")
|
|
|
|
| 15 |
print(f"Folder '{repo_dir}' does not exist.")
|
| 16 |
Repo.clone_from(git_url, repo_dir)
|
| 17 |
|
| 18 |
+
if os.getenv("FORCE", 'NO') != 'NO':
|
| 19 |
+
shutil.rmtree(repo_dir)
|
| 20 |
+
print("Force clone")
|
| 21 |
+
Repo.clone_from(git_url, repo_dir)
|
| 22 |
|
| 23 |
# Specify the folder you want to move and the current folder path
|
| 24 |
source_folder = "./my_number_temp/hnrecommender/"
|
| 25 |
+
destination_folder = f"{os.getcwd()}/hnrecommender" # Gets the path of the current
|
| 26 |
+
|
| 27 |
+
print(destination_folder)
|
| 28 |
# Check if the destination folder exists and remove it if it does
|
| 29 |
+
# if not os.path.exists(destination_folder):
|
| 30 |
+
os.makedirs(destination_folder,exist_ok=True)
|
| 31 |
+
# Copy the source folder to the destination
|
| 32 |
+
copy_tree(source_folder, destination_folder)
|
| 33 |
|
| 34 |
import streamlit as st
|
| 35 |
|