NeeravS's picture
Update app.py
c70aef4 verified
raw
history blame
1.16 kB
import streamlit as st
import os
from git import Repo
# Display the title
st.title("AI Based Video Summary Tool")
# Retrieve GitHub PAT from secrets
github_token = st.secrets["GITHUB_PAT"]
repo_url = st.secrets["REPO_URL"] # Add the repository URL as a secret
local_dir = "repo" # Directory to clone the repo into
# Clone the private repository
if not os.path.exists(local_dir):
if github_token and repo_url:
try:
# Use the provided token for authentication
if repo_url.startswith("https://"):
repo_url = repo_url.replace("https://", f"https://{github_token}@")
st.write(f"Cloning repository from {repo_url}...")
Repo.clone_from(repo_url, local_dir)
st.success("Repository cloned successfully!")
except Exception as e:
st.error(f"Error cloning repository: {e}")
else:
st.warning("Repository URL or GitHub token is missing.")
# Display contents of the cloned repository
if os.path.exists(local_dir):
files = os.listdir(local_dir)
st.write("Files in the repository:")
for file in files:
st.write(file)