Update app.py
Browse files
app.py
CHANGED
|
@@ -28,7 +28,9 @@ else:
|
|
| 28 |
os.environ['XDG_CACHE_HOME'] = "/home/user/huggingface"
|
| 29 |
|
| 30 |
os.environ['PLAYWRIGHT_BROWSERS_PATH'] = "/home/user/huggingface/ms-playwright"
|
| 31 |
-
|
|
|
|
|
|
|
| 32 |
|
| 33 |
import gradio as gr
|
| 34 |
import fitz # PyMuPDF
|
|
@@ -83,6 +85,7 @@ def extract_website_content(url, max_images=2):
|
|
| 83 |
browser.close()
|
| 84 |
except Exception as e:
|
| 85 |
print(f"Playwright headless fetch failed: {e}. Falling back to requests...")
|
|
|
|
| 86 |
response = requests.get(url, headers=headers, timeout=10)
|
| 87 |
response.raise_for_status()
|
| 88 |
html_content = response.content
|
|
|
|
| 28 |
os.environ['XDG_CACHE_HOME'] = "/home/user/huggingface"
|
| 29 |
|
| 30 |
os.environ['PLAYWRIGHT_BROWSERS_PATH'] = "/home/user/huggingface/ms-playwright"
|
| 31 |
+
|
| 32 |
+
os.system("python -m playwright install chromium")
|
| 33 |
+
os.system("ls -R /home/user/huggingface/ms-playwright/chromium_headless_shell-1223")
|
| 34 |
|
| 35 |
import gradio as gr
|
| 36 |
import fitz # PyMuPDF
|
|
|
|
| 85 |
browser.close()
|
| 86 |
except Exception as e:
|
| 87 |
print(f"Playwright headless fetch failed: {e}. Falling back to requests...")
|
| 88 |
+
os.system("ls -R /home/user/huggingface/ms-playwright/chromium_headless_shell-1223")
|
| 89 |
response = requests.get(url, headers=headers, timeout=10)
|
| 90 |
response.raise_for_status()
|
| 91 |
html_content = response.content
|