Spaces:
Running
Running
Commit
·
e613fe0
1
Parent(s):
2f91a8e
Remove Part Related to Failed Downloading Module
Browse files
app.py
CHANGED
|
@@ -16,23 +16,6 @@ import json
|
|
| 16 |
import itertools
|
| 17 |
import matplotlib.pyplot as plt
|
| 18 |
import matplotlib.colors as mcolors
|
| 19 |
-
import zipfile
|
| 20 |
-
import tempfile
|
| 21 |
-
import shutil
|
| 22 |
-
from selenium.webdriver.firefox.options import Options
|
| 23 |
-
from selenium.webdriver.firefox.service import Service
|
| 24 |
-
from selenium import webdriver
|
| 25 |
-
from bokeh.io import export_png
|
| 26 |
-
import os
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
from selenium import webdriver
|
| 30 |
-
from selenium.webdriver.firefox.service import Service as ChromeService
|
| 31 |
-
from selenium.webdriver.firefox.options import Options
|
| 32 |
-
from webdriver_manager.chrome import ChromeDriverManager
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
|
| 37 |
|
| 38 |
|
|
@@ -1303,38 +1286,38 @@ def run_model(model_name):
|
|
| 1303 |
# Mostrar el heatmap en la app
|
| 1304 |
st.bokeh_chart(heatmap_fig)
|
| 1305 |
|
| 1306 |
-
# Guardar la figura y el nombre correspondiente
|
| 1307 |
-
heatmap_figures.append(heatmap_fig)
|
| 1308 |
-
heatmap_names.append(f"heatmap_{selected_feature}_{x_comp}_vs_{y_comp}.png")
|
| 1309 |
|
| 1310 |
|
| 1311 |
-
# Inicializar el driver de Chrome en modo headless
|
| 1312 |
-
chrome_options = Options()
|
| 1313 |
-
chrome_options.add_argument("--headless")
|
| 1314 |
-
chrome_options.add_argument("--no-sandbox")
|
| 1315 |
-
chrome_options.add_argument("--disable-dev-shm-usage")
|
| 1316 |
-
driver = webdriver.Chrome(options=chrome_options, service=ChromeService(ChromeDriverManager().install()))
|
| 1317 |
|
| 1318 |
-
if st.button("Descargar todos los heatmaps"):
|
| 1319 |
-
|
| 1320 |
-
|
| 1321 |
-
|
| 1322 |
-
|
| 1323 |
-
|
| 1324 |
-
|
| 1325 |
-
|
| 1326 |
-
|
| 1327 |
-
|
| 1328 |
-
|
| 1329 |
-
|
| 1330 |
-
|
| 1331 |
-
|
| 1332 |
-
|
| 1333 |
-
|
| 1334 |
-
|
| 1335 |
-
|
| 1336 |
|
| 1337 |
-
driver.quit()
|
| 1338 |
|
| 1339 |
|
| 1340 |
def main():
|
|
|
|
| 16 |
import itertools
|
| 17 |
import matplotlib.pyplot as plt
|
| 18 |
import matplotlib.colors as mcolors
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 19 |
|
| 20 |
|
| 21 |
|
|
|
|
| 1286 |
# Mostrar el heatmap en la app
|
| 1287 |
st.bokeh_chart(heatmap_fig)
|
| 1288 |
|
| 1289 |
+
# # Guardar la figura y el nombre correspondiente
|
| 1290 |
+
# heatmap_figures.append(heatmap_fig)
|
| 1291 |
+
# heatmap_names.append(f"heatmap_{selected_feature}_{x_comp}_vs_{y_comp}.png")
|
| 1292 |
|
| 1293 |
|
| 1294 |
+
# # Inicializar el driver de Chrome en modo headless
|
| 1295 |
+
# chrome_options = Options()
|
| 1296 |
+
# chrome_options.add_argument("--headless")
|
| 1297 |
+
# chrome_options.add_argument("--no-sandbox")
|
| 1298 |
+
# chrome_options.add_argument("--disable-dev-shm-usage")
|
| 1299 |
+
# driver = webdriver.Chrome(options=chrome_options, service=ChromeService(ChromeDriverManager().install()))
|
| 1300 |
|
| 1301 |
+
# if st.button("Descargar todos los heatmaps"):
|
| 1302 |
+
# zip_buffer = io.BytesIO()
|
| 1303 |
+
# with tempfile.TemporaryDirectory() as tmpdirname:
|
| 1304 |
+
# with zipfile.ZipFile(zip_buffer, "w", zipfile.ZIP_DEFLATED) as zip_file:
|
| 1305 |
+
# # Exporta cada figura a PNG y añádela al ZIP
|
| 1306 |
+
# for fig, filename in zip(heatmap_figures, heatmap_names):
|
| 1307 |
+
# tmp_path = f"{tmpdirname}/{filename}"
|
| 1308 |
+
# export_png(fig, filename=tmp_path, driver=driver)
|
| 1309 |
+
# with open(tmp_path, "rb") as f:
|
| 1310 |
+
# zip_file.writestr(filename, f.read())
|
| 1311 |
+
# zip_buffer.seek(0)
|
| 1312 |
+
# st.download_button(
|
| 1313 |
+
# label="Descargar ZIP de heatmaps",
|
| 1314 |
+
# data=zip_buffer,
|
| 1315 |
+
# file_name="heatmaps.zip",
|
| 1316 |
+
# mime="application/zip",
|
| 1317 |
+
# key=f"download_heatmaps_{model_name}"
|
| 1318 |
+
# )
|
| 1319 |
|
| 1320 |
+
# driver.quit()
|
| 1321 |
|
| 1322 |
|
| 1323 |
def main():
|