Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -51,18 +51,8 @@ def decode_qr(img):
|
|
51 |
return data if data else "No QR code found."
|
52 |
|
53 |
|
54 |
-
# Load and encode the aesthetic image
|
55 |
-
def load_aesthetic_image(image_path):
|
56 |
-
with open(image_path, "rb") as image_file:
|
57 |
-
img_base64 = base64.b64encode(image_file.read()).decode("utf-8")
|
58 |
-
return f"data:image/png;base64,{img_base64}"
|
59 |
-
|
60 |
-
|
61 |
# Gradio Interface
|
62 |
def create_gradio_interface():
|
63 |
-
# Path to the aesthetic image (replace with the uploaded file path)
|
64 |
-
aesthetic_image_base64 = load_aesthetic_image("~/.cache/huggingface/hubspace-logo.png")
|
65 |
-
|
66 |
with gr.Blocks() as demo:
|
67 |
gr.Markdown("## QR Code Generator and Decoder")
|
68 |
|
@@ -110,17 +100,8 @@ def create_gradio_interface():
|
|
110 |
outputs=decoded_text,
|
111 |
)
|
112 |
|
113 |
-
# Add the aesthetic image at the bottom center
|
114 |
-
gr.HTML(
|
115 |
-
f"""
|
116 |
-
<div style="text-align: center; margin-top: 50px;">
|
117 |
-
<img src="{aesthetic_image_base64}" alt="Aesthetic Image" style="max-width: 200px; opacity: 0.8;">
|
118 |
-
</div>
|
119 |
-
"""
|
120 |
-
)
|
121 |
-
|
122 |
demo.launch(share=True)
|
123 |
|
124 |
|
125 |
# Run the Gradio interface
|
126 |
-
create_gradio_interface()
|
|
|
51 |
return data if data else "No QR code found."
|
52 |
|
53 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
54 |
# Gradio Interface
|
55 |
def create_gradio_interface():
|
|
|
|
|
|
|
56 |
with gr.Blocks() as demo:
|
57 |
gr.Markdown("## QR Code Generator and Decoder")
|
58 |
|
|
|
100 |
outputs=decoded_text,
|
101 |
)
|
102 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
103 |
demo.launch(share=True)
|
104 |
|
105 |
|
106 |
# Run the Gradio interface
|
107 |
+
create_gradio_interface()
|