Update app.py
Browse files
app.py
CHANGED
|
@@ -5,11 +5,20 @@ import requests
|
|
| 5 |
import numpy as np
|
| 6 |
import pandas as pd
|
| 7 |
from bs4 import BeautifulSoup
|
| 8 |
-
|
| 9 |
import gradio as gr
|
| 10 |
import folium
|
| 11 |
from folium.plugins import FloatImage
|
| 12 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13 |
# Configuration
|
| 14 |
file_name = 'bathing_sites.csv'
|
| 15 |
url = 'https://eau.gouvernement.lu/fr/domaines-activite/eauxbaignade/sites-de-baignade.html'
|
|
@@ -156,6 +165,4 @@ with gr.Blocks(title="LuxSplash") as app:
|
|
| 156 |
|
| 157 |
|
| 158 |
if __name__ == "__main__":
|
| 159 |
-
if "SPACE_ID" in os.environ: # Detect if running on Hugging Face Spaces
|
| 160 |
-
os.system("playwright install chromium")
|
| 161 |
app.launch()
|
|
|
|
| 5 |
import numpy as np
|
| 6 |
import pandas as pd
|
| 7 |
from bs4 import BeautifulSoup
|
| 8 |
+
import subprocess
|
| 9 |
import gradio as gr
|
| 10 |
import folium
|
| 11 |
from folium.plugins import FloatImage
|
| 12 |
|
| 13 |
+
# Install Playwright and dependencies if running in Hugging Face Space
|
| 14 |
+
if "SPACE_ID" in os.environ:
|
| 15 |
+
print("Running in Hugging Face Space - installing Playwright...")
|
| 16 |
+
subprocess.run([sys.executable, "-m", "pip", "install", "playwright"], check=True)
|
| 17 |
+
subprocess.run([sys.executable, "-m", "playwright", "install", "chromium"], check=True)
|
| 18 |
+
|
| 19 |
+
# Import Playwright after potential installation
|
| 20 |
+
from playwright.sync_api import sync_playwright
|
| 21 |
+
|
| 22 |
# Configuration
|
| 23 |
file_name = 'bathing_sites.csv'
|
| 24 |
url = 'https://eau.gouvernement.lu/fr/domaines-activite/eauxbaignade/sites-de-baignade.html'
|
|
|
|
| 165 |
|
| 166 |
|
| 167 |
if __name__ == "__main__":
|
|
|
|
|
|
|
| 168 |
app.launch()
|