Spaces:
Sleeping
Sleeping
Update app.py
Browse files
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 |
-
#
|
9 |
-
|
10 |
-
|
11 |
-
local_dir = "repo"
|
12 |
|
13 |
-
# Clone the private repository
|
14 |
if not os.path.exists(local_dir):
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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)
|