Update app.py
Browse files
app.py
CHANGED
|
@@ -5,12 +5,11 @@ from phi.model.google import Gemini
|
|
| 5 |
from phi.tools.duckduckgo import DuckDuckGo
|
| 6 |
from google.generativeai import upload_file, get_file
|
| 7 |
import google.generativeai as genai
|
| 8 |
-
|
| 9 |
import time
|
| 10 |
-
from pathlib import Path
|
| 11 |
-
from dotenv import load_dotenv
|
| 12 |
import os
|
|
|
|
| 13 |
import tempfile
|
|
|
|
| 14 |
|
| 15 |
# Load environment variables
|
| 16 |
load_dotenv()
|
|
@@ -41,16 +40,13 @@ def initialize_agent():
|
|
| 41 |
multimodal_Agent = initialize_agent()
|
| 42 |
|
| 43 |
# Function to download YouTube video using yt-dlp
|
| 44 |
-
from yt_dlp import YoutubeDL
|
| 45 |
-
import tempfile
|
| 46 |
-
|
| 47 |
def download_youtube_video(youtube_url):
|
| 48 |
"""
|
| 49 |
Downloads a YouTube video using yt-dlp with cookies for authentication.
|
| 50 |
-
|
| 51 |
Parameters:
|
| 52 |
- youtube_url: The URL of the YouTube video.
|
| 53 |
-
|
| 54 |
Returns:
|
| 55 |
- The path to the downloaded video file.
|
| 56 |
"""
|
|
@@ -77,7 +73,6 @@ def download_youtube_video(youtube_url):
|
|
| 77 |
except Exception as e:
|
| 78 |
raise RuntimeError(f"An error occurred while downloading the video: {str(e)}")
|
| 79 |
|
| 80 |
-
|
| 81 |
# YouTube video URL input
|
| 82 |
youtube_url = st.text_input(
|
| 83 |
"Enter the YouTube video link",
|
|
|
|
| 5 |
from phi.tools.duckduckgo import DuckDuckGo
|
| 6 |
from google.generativeai import upload_file, get_file
|
| 7 |
import google.generativeai as genai
|
|
|
|
| 8 |
import time
|
|
|
|
|
|
|
| 9 |
import os
|
| 10 |
+
from pathlib import Path
|
| 11 |
import tempfile
|
| 12 |
+
from dotenv import load_dotenv
|
| 13 |
|
| 14 |
# Load environment variables
|
| 15 |
load_dotenv()
|
|
|
|
| 40 |
multimodal_Agent = initialize_agent()
|
| 41 |
|
| 42 |
# Function to download YouTube video using yt-dlp
|
|
|
|
|
|
|
|
|
|
| 43 |
def download_youtube_video(youtube_url):
|
| 44 |
"""
|
| 45 |
Downloads a YouTube video using yt-dlp with cookies for authentication.
|
| 46 |
+
|
| 47 |
Parameters:
|
| 48 |
- youtube_url: The URL of the YouTube video.
|
| 49 |
+
|
| 50 |
Returns:
|
| 51 |
- The path to the downloaded video file.
|
| 52 |
"""
|
|
|
|
| 73 |
except Exception as e:
|
| 74 |
raise RuntimeError(f"An error occurred while downloading the video: {str(e)}")
|
| 75 |
|
|
|
|
| 76 |
# YouTube video URL input
|
| 77 |
youtube_url = st.text_input(
|
| 78 |
"Enter the YouTube video link",
|