Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -10,6 +10,14 @@ from typing import Iterable
|
|
| 10 |
from gradio.themes import Soft
|
| 11 |
from gradio.themes.utils import colors, fonts, sizes
|
| 12 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13 |
# Initialize environment paths
|
| 14 |
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
|
| 15 |
PAPERS_DIR = os.path.join(BASE_DIR, "papers")
|
|
|
|
| 10 |
from gradio.themes import Soft
|
| 11 |
from gradio.themes.utils import colors, fonts, sizes
|
| 12 |
|
| 13 |
+
# 自动安装 Playwright 浏览器(如果不存在)
|
| 14 |
+
try:
|
| 15 |
+
import playwright
|
| 16 |
+
# 检查是否已经安装了浏览器,没有则下载
|
| 17 |
+
subprocess.run(["playwright", "install", "chromium"], check=True)
|
| 18 |
+
except Exception as e:
|
| 19 |
+
print(f"Playwright setup failed: {e}")
|
| 20 |
+
|
| 21 |
# Initialize environment paths
|
| 22 |
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
|
| 23 |
PAPERS_DIR = os.path.join(BASE_DIR, "papers")
|