Spaces:
Sleeping
Sleeping
Alexandre Gazola
commited on
Commit
·
a58f522
1
Parent(s):
3f92e8d
fix
Browse files- audio_to_text_tool.py +4 -0
- files/cookies.txt +26 -0
- langchain_agent.py +2 -2
audio_to_text_tool.py
CHANGED
@@ -65,11 +65,15 @@ def audio_to_text_from_youtube(youtube_url: str) -> str:
|
|
65 |
with tempfile.TemporaryDirectory() as tmpdir:
|
66 |
audio_output_path = os.path.join(tmpdir, "audio.mp3")
|
67 |
|
|
|
|
|
|
|
68 |
# Download best audio using yt-dlp
|
69 |
ydl_opts = {
|
70 |
"format": "bestaudio/best",
|
71 |
"outtmpl": audio_output_path,
|
72 |
"quiet": True,
|
|
|
73 |
"postprocessors": [{
|
74 |
"key": "FFmpegExtractAudio",
|
75 |
"preferredcodec": "mp3",
|
|
|
65 |
with tempfile.TemporaryDirectory() as tmpdir:
|
66 |
audio_output_path = os.path.join(tmpdir, "audio.mp3")
|
67 |
|
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",
|
74 |
"outtmpl": audio_output_path,
|
75 |
"quiet": True,
|
76 |
+
"cookiefile": cookies_path,
|
77 |
"postprocessors": [{
|
78 |
"key": "FFmpegExtractAudio",
|
79 |
"preferredcodec": "mp3",
|
files/cookies.txt
ADDED
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Netscape HTTP Cookie File
|
2 |
+
# http://curl.haxx.se/rfc/cookie_spec.html
|
3 |
+
# This is a generated file! Do not edit.
|
4 |
+
|
5 |
+
.youtube.com TRUE / TRUE 1783556799 PREF f7=4000&tz=America.Sao_Paulo&f5=20000
|
6 |
+
.youtube.com TRUE / FALSE 1759784043 _ga GA1.1.11386904.1725224043
|
7 |
+
.youtube.com TRUE / FALSE 1759795830 _ga_VCGEPY40VB GS1.1.1725235830.2.0.1725235830.60.0.0
|
8 |
+
.youtube.com TRUE / FALSE 1782739267 HSID AsSdxijjWfMYoUNbH
|
9 |
+
.youtube.com TRUE / TRUE 1782739267 SSID A6kqqjqYKPsv1VFWB
|
10 |
+
.youtube.com TRUE / FALSE 1782739267 APISID yDYBsmDVqbZWFt4T/A21BTx2UdIPv9FGzy
|
11 |
+
.youtube.com TRUE / TRUE 1782739267 SAPISID RP1F2xSbxZZLgCGm/A7WpLzHs_LOhD60Cq
|
12 |
+
.youtube.com TRUE / TRUE 1782739267 __Secure-1PAPISID RP1F2xSbxZZLgCGm/A7WpLzHs_LOhD60Cq
|
13 |
+
.youtube.com TRUE / TRUE 1782739267 __Secure-3PAPISID RP1F2xSbxZZLgCGm/A7WpLzHs_LOhD60Cq
|
14 |
+
.youtube.com TRUE / TRUE 1761133295 LOGIN_INFO AFmmF2swRQIgYZDr9CFSQJMQBYjaoFPVH23u0oYEbgO-K_wGgOxs-aACIQDzYUnFCaXp8Qqv5V5g-vCo-Vxz38a4pOQdVlagLpmXiA:QUQ3MjNmeTJJbnR2aTZnY0I0RktGYThWbUVObWx5eVNaZk04NWVuSUZQa21SbTI1TG5pZWdwTnB2WVRtX3E1M3BuR0txbUtuaGd4bHpDaU9ERHV6dm5ja0F2bTBQU214RDhnb1U1bndvc19qdzdLQWNWWE5McFdzeEV6d016Z0dCNGlSZHFhOEZZNXJabGZwWVRnUHNPdHJrd2dTMElabzdR
|
15 |
+
.youtube.com TRUE / FALSE 1782739267 SID g.a000xQgBMtqGoLVN9LjIY-PCtAQCUVdpeYIf2dj6YhnInZ9FOoEW15xU1kjfZ3o4hb06bDhfQAACgYKARISARISFQHGX2Miu_WCvCjzHSFuVkgNXm-E2xoVAUF8yKowDOXRCiLfZHBfvypgIwDG0076
|
16 |
+
.youtube.com TRUE / TRUE 1782739267 __Secure-1PSID g.a000xQgBMtqGoLVN9LjIY-PCtAQCUVdpeYIf2dj6YhnInZ9FOoEWw6mXxygNXs5qs6jMrK1oewACgYKAfUSARISFQHGX2MiAhnGI079BEXd9dGoewl-PBoVAUF8yKp2xdOiOX5FLTSIqe8V7z-H0076
|
17 |
+
.youtube.com TRUE / TRUE 1782739267 __Secure-3PSID g.a000xQgBMtqGoLVN9LjIY-PCtAQCUVdpeYIf2dj6YhnInZ9FOoEWnhHklcliGk7Ji3DqLZ6t3wACgYKAZgSARISFQHGX2Mi1qM5kT8xqiUqBpjjETN6mBoVAUF8yKpHjxH8elFbe67iRrLnQIWB0076
|
18 |
+
.youtube.com TRUE / TRUE 1780532801 __Secure-1PSIDTS sidts-CjEB5H03P7fsp29tq4yvZZQvpB85wdrK5CTXIYiSR87yTq1QxJjFM_s0aiGxzZc1BlA-EAA
|
19 |
+
.youtube.com TRUE / TRUE 1780532801 __Secure-3PSIDTS sidts-CjEB5H03P7fsp29tq4yvZZQvpB85wdrK5CTXIYiSR87yTq1QxJjFM_s0aiGxzZc1BlA-EAA
|
20 |
+
.youtube.com TRUE / FALSE 1780532804 SIDCC AKEyXzWM-zRCB9VF6KvQUBdkkaKCMq6S0L8iGsjLzn9s5SDiw4Xsak82gvTzxNO9Dw_fCXMVhac
|
21 |
+
.youtube.com TRUE / TRUE 1780532804 __Secure-1PSIDCC AKEyXzUWv3Zv5QVR5pzeb3aBwAKNSbfv8ZYQY2ssKL3AdEW0Gq3m61QMYbYuWPs1bIkXBslIA1M
|
22 |
+
.youtube.com TRUE / TRUE 1780532804 __Secure-3PSIDCC AKEyXzXFwwzhiJSEAjP1IlPwo0tVSRJ9ORNr55dMIZQ7HOx0wutencyWAqXr4iT_ZkoadM0f5RPZ
|
23 |
+
.youtube.com TRUE / TRUE 1764548803 VISITOR_INFO1_LIVE EJ7QdW8AcBg
|
24 |
+
.youtube.com TRUE / TRUE 1764548803 VISITOR_PRIVACY_METADATA CgJCUhIEGgAgIg%3D%3D
|
25 |
+
.youtube.com TRUE / TRUE 0 YSC PzhmzIJgyNU
|
26 |
+
.youtube.com TRUE / TRUE 1764548797 __Secure-ROLLOUT_TOKEN CIKIwKb58snzjAEQ-7nTvOe9igMY5tSI5sDWjQM%3D
|
langchain_agent.py
CHANGED
@@ -35,8 +35,8 @@ class LangChainAgent:
|
|
35 |
parse_excel,
|
36 |
chess_image_to_fen,
|
37 |
get_chess_best_move,
|
38 |
-
audio_to_text
|
39 |
-
|
40 |
]
|
41 |
|
42 |
prompt = ChatPromptTemplate.from_messages([
|
|
|
35 |
parse_excel,
|
36 |
chess_image_to_fen,
|
37 |
get_chess_best_move,
|
38 |
+
audio_to_text,
|
39 |
+
audio_to_text_from_youtube
|
40 |
]
|
41 |
|
42 |
prompt = ChatPromptTemplate.from_messages([
|