Spaces:
Runtime error
Runtime error
import gradio as gr | |
import qrcode | |
def url_to_qr(url): | |
qr = qrcode.QRCode( | |
version=1, | |
error_correction=qrcode.constants.ERROR_CORRECT_L, | |
box_size=10, | |
border=4, | |
) | |
qr.add_data(url) | |
qr.make(fit=True) | |
img = qr.make_image(fill_color="black", back_color="white") | |
img_file = "qr_code.png" | |
img.save(img_file) | |
return img_file | |
url_input = gr.Textbox(lines=2, label="Enter URL") | |
output_qr = gr.Image(type="file", label="QR Code") | |
gr.Interface(fn=url_to_qr, inputs=url_input, outputs=output_qr, title="URL to QR Code").launch() | |