Update app.py
Browse files
app.py
CHANGED
|
@@ -12,6 +12,7 @@ from sklearn.metrics.pairwise import cosine_similarity
|
|
| 12 |
import google.generativeai as genai
|
| 13 |
from llama_index.core import SimpleDirectoryReader
|
| 14 |
from llama_index.multi_modal_llms.gemini import GeminiMultiModal
|
|
|
|
| 15 |
|
| 16 |
# Ensure you have the necessary dependencies installed:
|
| 17 |
# pip install streamlit yt-dlp youtube_transcript_api torch pillow sentence-transformers scikit-learn google-generativeai llama-index
|
|
@@ -42,7 +43,8 @@ def video_to_images(video_url, output_folder):
|
|
| 42 |
'ffmpeg', '-i', video_filepath, '-vf', 'fps=0.2', frame_output_pattern
|
| 43 |
]
|
| 44 |
subprocess.run(ffmpeg_command)
|
| 45 |
-
|
|
|
|
| 46 |
|
| 47 |
# Function to extract transcript
|
| 48 |
def extract_youtube_transcript(video_url):
|
|
|
|
| 12 |
import google.generativeai as genai
|
| 13 |
from llama_index.core import SimpleDirectoryReader
|
| 14 |
from llama_index.multi_modal_llms.gemini import GeminiMultiModal
|
| 15 |
+
import dotenv
|
| 16 |
|
| 17 |
# Ensure you have the necessary dependencies installed:
|
| 18 |
# pip install streamlit yt-dlp youtube_transcript_api torch pillow sentence-transformers scikit-learn google-generativeai llama-index
|
|
|
|
| 43 |
'ffmpeg', '-i', video_filepath, '-vf', 'fps=0.2', frame_output_pattern
|
| 44 |
]
|
| 45 |
subprocess.run(ffmpeg_command)
|
| 46 |
+
os.remove(video_filepath)
|
| 47 |
+
return "Frames extracted successfully and video is deleted."
|
| 48 |
|
| 49 |
# Function to extract transcript
|
| 50 |
def extract_youtube_transcript(video_url):
|