Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -5,25 +5,26 @@ from git import Repo
|
|
5 |
# Display the title
|
6 |
st.title("AI Based Video Summary Tool")
|
7 |
|
8 |
-
#
|
9 |
github_token = st.secrets["GITHUB_PAT"]
|
10 |
-
repo_url = st.
|
11 |
local_dir = "repo" # Directory to clone the repo into
|
12 |
|
13 |
# Clone the private repository
|
14 |
-
if
|
15 |
if github_token and repo_url:
|
16 |
try:
|
17 |
# Use the provided token for authentication
|
18 |
if repo_url.startswith("https://"):
|
19 |
repo_url = repo_url.replace("https://", f"https://{github_token}@")
|
20 |
|
|
|
21 |
Repo.clone_from(repo_url, local_dir)
|
22 |
st.success("Repository cloned successfully!")
|
23 |
except Exception as e:
|
24 |
st.error(f"Error cloning repository: {e}")
|
25 |
else:
|
26 |
-
st.warning("
|
27 |
|
28 |
# Display contents of the cloned repository
|
29 |
if os.path.exists(local_dir):
|
|
|
5 |
# Display the title
|
6 |
st.title("AI Based Video Summary Tool")
|
7 |
|
8 |
+
# Retrieve GitHub PAT from secrets
|
9 |
github_token = st.secrets["GITHUB_PAT"]
|
10 |
+
repo_url = st.secrets["REPO_URL"] # Add the repository URL as a secret
|
11 |
local_dir = "repo" # Directory to clone the repo into
|
12 |
|
13 |
# Clone the private repository
|
14 |
+
if not os.path.exists(local_dir):
|
15 |
if github_token and repo_url:
|
16 |
try:
|
17 |
# Use the provided token for authentication
|
18 |
if repo_url.startswith("https://"):
|
19 |
repo_url = repo_url.replace("https://", f"https://{github_token}@")
|
20 |
|
21 |
+
st.write(f"Cloning repository from {repo_url}...")
|
22 |
Repo.clone_from(repo_url, local_dir)
|
23 |
st.success("Repository cloned successfully!")
|
24 |
except Exception as e:
|
25 |
st.error(f"Error cloning repository: {e}")
|
26 |
else:
|
27 |
+
st.warning("Repository URL or GitHub token is missing.")
|
28 |
|
29 |
# Display contents of the cloned repository
|
30 |
if os.path.exists(local_dir):
|