Spaces:
Sleeping
Sleeping
Update audio_to_text_tool.py
Browse files- audio_to_text_tool.py +5 -0
audio_to_text_tool.py
CHANGED
@@ -9,6 +9,7 @@ import openai
|
|
9 |
from openai import OpenAI
|
10 |
from langchain.tools import tool
|
11 |
import yt_dlp
|
|
|
12 |
|
13 |
# Initialize OpenAI client (uses OPENAI_API_KEY from environment or explicitly)
|
14 |
client = OpenAI(api_key=OPENAI_KEY)
|
@@ -68,6 +69,10 @@ def audio_to_text_from_youtube(youtube_url: str) -> str:
|
|
68 |
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
|
69 |
cookies_path = os.path.join(BASE_DIR, 'files', 'cookies.txt')
|
70 |
|
|
|
|
|
|
|
|
|
71 |
# Download best audio using yt-dlp
|
72 |
ydl_opts = {
|
73 |
"format": "bestaudio/best",
|
|
|
9 |
from openai import OpenAI
|
10 |
from langchain.tools import tool
|
11 |
import yt_dlp
|
12 |
+
from utils import get_bytes, get_text_file_contents, get_base64
|
13 |
|
14 |
# Initialize OpenAI client (uses OPENAI_API_KEY from environment or explicitly)
|
15 |
client = OpenAI(api_key=OPENAI_KEY)
|
|
|
69 |
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
|
70 |
cookies_path = os.path.join(BASE_DIR, 'files', 'cookies.txt')
|
71 |
|
72 |
+
plain_txt_file = get_text_file_contents(cookies_path)
|
73 |
+
|
74 |
+
print('cookies: \n' + plain_txt_file)
|
75 |
+
|
76 |
# Download best audio using yt-dlp
|
77 |
ydl_opts = {
|
78 |
"format": "bestaudio/best",
|