import gradio as gr | |
import pyqrcode | |
import os | |
# Function to generate QR code and save as an image file | |
def generate_qr_code(link): | |
url = pyqrcode.create(link) | |
file_name = "myqrcode.png" | |
url.png(file_name, scale=10) | |
return file_name | |
# Create Gradio Interface | |
iface = gr.Interface( | |
fn=generate_qr_code, | |
inputs=gr.inputs.Textbox(lines=2, placeholder="Enter URL Here..."), | |
outputs="image", | |
title="QR Code Generator", | |
description="Paste a link and generate its QR code." | |
) | |
# Launch the interface | |
iface.launch() | |