acecalisto3 commited on
Commit
410fdcd
·
verified ·
1 Parent(s): 6d420ce

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -12
app.py CHANGED
@@ -321,24 +321,24 @@ class FileProcessor:
321
  'timestamp': datetime.now().isoformat()
322
  })
323
 
324
- # Generate output
325
- if results:
326
- output_dir = Path('output') / datetime.now().strftime('%Y-%m-%d')
327
- output_dir.mkdir(parents=True, exist_ok=True)
328
- output_path = output_dir / f'processed_{int(time.time())}.json'
329
 
330
- with open(output_path, 'w', encoding='utf-8') as f:
331
- json.dump(results, f, ensure_ascii=False, indent=2)
332
 
333
- summary = f"Processed {len(results)} items successfully!"
334
- json_data = json.dumps(results, indent=2) # Prepare JSON for QR code
335
  return str(output_path), summary, json_data # Return JSON for editor
336
  else:
337
  return None, "No valid content to process.", ""
338
 
339
- except Exception as e:
340
- logger.error(f"Processing error: {e}")
341
- return None, f"Error: {str(e)}", ""
342
 
343
  def generate_qr_code(json_data):
344
  """Generate QR code from JSON data and return the file path."""
 
321
  'timestamp': datetime.now().isoformat()
322
  })
323
 
324
+ # Generate output
325
+ if results:
326
+ output_dir = Path('output') / datetime.now().strftime('%Y-%m-%d')
327
+ output_dir.mkdir(parents=True, exist_ok=True)
328
+ output_path = output_dir / f'processed_{int(time.time())}.json'
329
 
330
+ with open(output_path, 'w', encoding='utf-8') as f:
331
+ json.dump(results, f, ensure_ascii=False, indent=2)
332
 
333
+ summary = f"Processed {len(results)} items successfully!"
334
+ json_data = json.dumps(results, indent=2) # Prepare JSON for QR code
335
  return str(output_path), summary, json_data # Return JSON for editor
336
  else:
337
  return None, "No valid content to process.", ""
338
 
339
+ except Exception as e:
340
+ logger.error(f"Processing error: {e}")
341
+ return None, f"Error: {str(e)}", ""
342
 
343
  def generate_qr_code(json_data):
344
  """Generate QR code from JSON data and return the file path."""