acecalisto3 commited on
Commit
dc46bf4
·
verified ·
1 Parent(s): 8b09102

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -0
app.py CHANGED
@@ -246,6 +246,13 @@ def _process_single_file(self, file) -> List[Dict]:
246
 
247
  def generate_qr_code(json_data):
248
  """Generate a QR code from JSON data."""
 
 
 
 
 
 
 
249
  qr = qrcode.make(json_data)
250
  qr_path = "output/qr_code.png"
251
  qr.save(qr_path)
 
246
 
247
  def generate_qr_code(json_data):
248
  """Generate a QR code from JSON data."""
249
+ # Limit the size of json_data to avoid exceeding QR code version limits
250
+ max_length = 2953 # Maximum length for version 40 (the highest version)
251
+
252
+ if len(json_data) > max_length:
253
+ logger.warning("JSON data is too large for QR code generation. Truncating data.")
254
+ json_data = json_data[:max_length] # Truncate the data
255
+
256
  qr = qrcode.make(json_data)
257
  qr_path = "output/qr_code.png"
258
  qr.save(qr_path)