Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -1,11 +1,11 @@
|
|
1 |
import qrcode
|
2 |
-
import
|
3 |
import gradio as gr
|
4 |
|
5 |
# Function to process text and generate QR code
|
6 |
def txt2qrcode(text: str):
|
7 |
# Encode the text as URL-safe base64 or URL encoding
|
8 |
-
encoded_text =
|
9 |
|
10 |
# Construct the final URL to embed into the QR code
|
11 |
final_url = f"https://flowly-ai.vercel.app/tools/qr/pro-qr-codes/read/{encoded_text}"
|
@@ -38,7 +38,7 @@ def qr_code_interface(text: str):
|
|
38 |
interface = gr.Interface(
|
39 |
fn=qr_code_interface,
|
40 |
inputs=gr.Textbox(label="Enter Text to Encode", placeholder="Enter your text here..."),
|
41 |
-
outputs=gr.Image(type="
|
42 |
description="Generate a QR Code from your text. The input text will be URL encoded and embedded into a QR code pointing to a specific URL.",
|
43 |
css="footer {visibility: hidden}"
|
44 |
)
|
|
|
1 |
import qrcode
|
2 |
+
import base64
|
3 |
import gradio as gr
|
4 |
|
5 |
# Function to process text and generate QR code
|
6 |
def txt2qrcode(text: str):
|
7 |
# Encode the text as URL-safe base64 or URL encoding
|
8 |
+
encoded_text = base64.b64encode(text.encode('utf-8')).decode('utf-8') # URL encoding the input text
|
9 |
|
10 |
# Construct the final URL to embed into the QR code
|
11 |
final_url = f"https://flowly-ai.vercel.app/tools/qr/pro-qr-codes/read/{encoded_text}"
|
|
|
38 |
interface = gr.Interface(
|
39 |
fn=qr_code_interface,
|
40 |
inputs=gr.Textbox(label="Enter Text to Encode", placeholder="Enter your text here..."),
|
41 |
+
outputs=gr.Image(type="filepath", label="Generated QR Code"),
|
42 |
description="Generate a QR Code from your text. The input text will be URL encoded and embedded into a QR code pointing to a specific URL.",
|
43 |
css="footer {visibility: hidden}"
|
44 |
)
|