Spaces:
Runtime error
Runtime error
danilotpnta
commited on
Commit
·
1b65381
1
Parent(s):
f80a7eb
add: dependencies needed for playwright
Browse files
app.py
CHANGED
@@ -5,12 +5,25 @@ import asyncio
|
|
5 |
|
6 |
import subprocess
|
7 |
|
8 |
-
# Ensure Playwright is installed and
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
14 |
|
15 |
from download_video import download_mp3_playwright
|
16 |
|
|
|
5 |
|
6 |
import subprocess
|
7 |
|
8 |
+
# Ensure Playwright is installed and system dependencies are downloaded
|
9 |
+
def install_playwright_deps():
|
10 |
+
try:
|
11 |
+
# Install Playwright via pip if not already installed
|
12 |
+
subprocess.run(["pip", "install", "playwright"], check=True)
|
13 |
+
|
14 |
+
# Install system dependencies for Playwright
|
15 |
+
subprocess.run(["playwright", "install-deps"], check=True)
|
16 |
+
|
17 |
+
# Install the Playwright browsers
|
18 |
+
subprocess.run(["playwright", "install"], check=True)
|
19 |
+
|
20 |
+
print("Playwright dependencies and browsers installed.")
|
21 |
+
except subprocess.CalledProcessError as e:
|
22 |
+
print(f"Error during Playwright setup: {e}")
|
23 |
+
exit(1)
|
24 |
+
|
25 |
+
# Call the function to install system dependencies and Playwright
|
26 |
+
install_playwright_deps()
|
27 |
|
28 |
from download_video import download_mp3_playwright
|
29 |
|