Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -364,9 +364,20 @@ def create_interface():
|
|
364 |
except Exception as e:
|
365 |
logger.error(f"Processing error: {e}")
|
366 |
return None, f"Error: {str(e)}", ""
|
367 |
-
|
|
|
368 |
def generate_qr(json_data):
|
369 |
"""Generate QR code from JSON data and return the file path."""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
370 |
if json_data:
|
371 |
return generate_qr_code(json_data)
|
372 |
return None
|
@@ -383,6 +394,7 @@ def create_interface():
|
|
383 |
outputs=qr_output
|
384 |
)
|
385 |
|
|
|
386 |
gr.Markdown("""
|
387 |
### Usage Guidelines
|
388 |
- **URL Processing**: Enter valid HTTP/HTTPS URLs
|
|
|
364 |
except Exception as e:
|
365 |
logger.error(f"Processing error: {e}")
|
366 |
return None, f"Error: {str(e)}", ""
|
367 |
+
|
368 |
+
|
369 |
def generate_qr(json_data):
|
370 |
"""Generate QR code from JSON data and return the file path."""
|
371 |
+
qr = qrcode.QRCode(
|
372 |
+
version=40, # Force maximum version
|
373 |
+
error_correction=qrcode.constants.ERROR_CORRECT_L, # Use lower error correction
|
374 |
+
box_size=10,
|
375 |
+
border=4,
|
376 |
+
)
|
377 |
+
qr.add_data(json_data)
|
378 |
+
qr.make(fit=True)
|
379 |
+
return qr.make_image(fill_color="black", back_color="white")
|
380 |
+
|
381 |
if json_data:
|
382 |
return generate_qr_code(json_data)
|
383 |
return None
|
|
|
394 |
outputs=qr_output
|
395 |
)
|
396 |
|
397 |
+
|
398 |
gr.Markdown("""
|
399 |
### Usage Guidelines
|
400 |
- **URL Processing**: Enter valid HTTP/HTTPS URLs
|