NeeravS commited on
Commit
35eccef
·
verified ·
1 Parent(s): c70aef4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +35 -25
app.py CHANGED
@@ -1,34 +1,44 @@
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
- # 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):
31
- files = os.listdir(local_dir)
32
- st.write("Files in the repository:")
33
- for file in files:
34
- st.write(file)
 
 
 
 
 
 
 
 
 
 
1
  import streamlit as st
2
  import os
3
  from git import Repo
4
+ import sys
5
 
6
  # Display the title
7
  st.title("AI Based Video Summary Tool")
8
 
9
+ # GitHub Repository and Directory Setup
10
+ repo_url = st.secrets["REPO_URL"] # The private repository URL
11
+ github_token = st.secrets["GITHUB_PAT"] # GitHub Personal Access Token
12
+ local_dir = "repo"
13
 
14
+ # Clone the private repository if it doesn't exist locally
15
  if not os.path.exists(local_dir):
16
+ try:
17
+ repo_url = repo_url.replace("https://", f"https://{github_token}@")
18
+ st.write("Cloning the repository...")
19
+ Repo.clone_from(repo_url, local_dir)
20
+ st.success("Repository cloned successfully!")
21
+ sys.path.insert(0, local_dir) # Add the repo directory to the system path
22
+ except Exception as e:
23
+ st.error(f"Error cloning repository: {e}")
24
+ else:
25
+ st.write("Repository already cloned.")
26
+
27
+ # Import the necessary module from the cloned repository
28
+ try:
29
+ from your_video_processing_module import process_video # Adjust to your actual module
30
+ except ImportError as e:
31
+ st.error(f"Error importing module: {e}")
32
+
33
+ # Video Summarization Interface
34
+ st.title("Video Summarization with Llama 3.1")
35
+
36
+ uploaded_video = st.file_uploader("Upload a video", type=["mp4", "avi", "mov"])
37
+
38
+ if uploaded_video is not None:
39
+ st.video(uploaded_video)
40
+
41
+ # Process the uploaded video
42
+ summary = process_video(uploaded_video)
43
+ st.write("Video Summary:")
44
+ st.write(summary)