Spaces:
Sleeping
Sleeping
Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import streamlit as st
|
| 2 |
+
import os
|
| 3 |
+
from git import Repo
|
| 4 |
+
|
| 5 |
+
# Display the title
|
| 6 |
+
st.title("AI Based Video Summary Tool")
|
| 7 |
+
|
| 8 |
+
# Use secret management for GitHub PAT
|
| 9 |
+
github_token = st.secrets["GITHUB_PAT"]
|
| 10 |
+
repo_url = st.text_input("https://github.com/NeeravSood/VST_HF")
|
| 11 |
+
local_dir = "repo" # Directory to clone the repo into
|
| 12 |
+
|
| 13 |
+
# Clone the private repository
|
| 14 |
+
if st.button("Clone Repository"):
|
| 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("Please provide the repository URL.")
|
| 27 |
+
|
| 28 |
+
# Display contents of the cloned repository
|
| 29 |
+
if os.path.exists(local_dir):
|
| 30 |
+
files = os.listdir(local_dir)
|
| 31 |
+
st.write("Files in the repository:")
|
| 32 |
+
for file in files:
|
| 33 |
+
st.write(file)
|