C2MV commited on
Commit
ff70361
·
verified ·
1 Parent(s): cffe4a4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -2
app.py CHANGED
@@ -14,13 +14,11 @@ import asyncio
14
  import aiohttp
15
  from concurrent.futures import ThreadPoolExecutor
16
 
17
-
18
  # Configure logging
19
  logging.basicConfig(level=logging.INFO,
20
  format='%(asctime)s - %(levelname)s: %(message)s')
21
  logger = logging.getLogger(__name__)
22
 
23
-
24
  class PaperDownloader:
25
  def __init__(self, output_dir='papers'):
26
  self.output_dir = output_dir
@@ -472,6 +470,13 @@ class PaperDownloader:
472
  logger.info(f"ZIP file created: {zip_filename}")
473
 
474
  return zip_filename, "\n".join(downloaded_links), "\n".join(failed_dois)
 
 
 
 
 
 
 
475
 
476
  def create_gradio_interface():
477
  """Create Gradio interface for Paper Downloader"""
 
14
  import aiohttp
15
  from concurrent.futures import ThreadPoolExecutor
16
 
 
17
  # Configure logging
18
  logging.basicConfig(level=logging.INFO,
19
  format='%(asctime)s - %(levelname)s: %(message)s')
20
  logger = logging.getLogger(__name__)
21
 
 
22
  class PaperDownloader:
23
  def __init__(self, output_dir='papers'):
24
  self.output_dir = output_dir
 
470
  logger.info(f"ZIP file created: {zip_filename}")
471
 
472
  return zip_filename, "\n".join(downloaded_links), "\n".join(failed_dois)
473
+
474
+ def create_zip(self, zip_filename, files):
475
+ """Crea un archivo zip con los pdfs descargados"""
476
+ with zipfile.ZipFile(zip_filename, 'w', zipfile.ZIP_DEFLATED) as zf:
477
+ for file in files:
478
+ zf.write(file, os.path.basename(file))
479
+
480
 
481
  def create_gradio_interface():
482
  """Create Gradio interface for Paper Downloader"""