Spaces:
Running
Running
add example image
Browse files- myapp/app.py +4 -3
- myapp/example.webp +0 -0
myapp/app.py
CHANGED
|
@@ -36,7 +36,7 @@ with gr.Blocks() as demo:
|
|
| 36 |
|
| 37 |
with gr.Column():
|
| 38 |
output = gr.Image()
|
| 39 |
-
background = gr.Image(visible=False, type="filepath")
|
| 40 |
scale = gr.Slider(3, 15, 9, step=1, label="Scale")
|
| 41 |
|
| 42 |
with gr.Row():
|
|
@@ -60,7 +60,7 @@ with gr.Blocks() as demo:
|
|
| 60 |
matches = re.findall(r"\d+(?:\.\d+)?", value)
|
| 61 |
r, g, b = map(int, map(float, matches[:3]))
|
| 62 |
|
| 63 |
-
return f"#{r:
|
| 64 |
|
| 65 |
image = Image.open(data[background])
|
| 66 |
qr_code = segno.make(data[text], error="h")
|
|
@@ -69,7 +69,7 @@ with gr.Blocks() as demo:
|
|
| 69 |
write_artistic(
|
| 70 |
qr_code,
|
| 71 |
target=buffer,
|
| 72 |
-
background=image.
|
| 73 |
kind=image.format,
|
| 74 |
scale=data[scale],
|
| 75 |
light=to_hex_format(data[color_light]),
|
|
@@ -93,6 +93,7 @@ with gr.Blocks() as demo:
|
|
| 93 |
|
| 94 |
gr.on(
|
| 95 |
[
|
|
|
|
| 96 |
text.submit,
|
| 97 |
background.change,
|
| 98 |
scale.change,
|
|
|
|
| 36 |
|
| 37 |
with gr.Column():
|
| 38 |
output = gr.Image()
|
| 39 |
+
background = gr.Image("example.webp", visible=False, type="filepath")
|
| 40 |
scale = gr.Slider(3, 15, 9, step=1, label="Scale")
|
| 41 |
|
| 42 |
with gr.Row():
|
|
|
|
| 60 |
matches = re.findall(r"\d+(?:\.\d+)?", value)
|
| 61 |
r, g, b = map(int, map(float, matches[:3]))
|
| 62 |
|
| 63 |
+
return f"#{r:02X}{g:02X}{b:02X}"
|
| 64 |
|
| 65 |
image = Image.open(data[background])
|
| 66 |
qr_code = segno.make(data[text], error="h")
|
|
|
|
| 69 |
write_artistic(
|
| 70 |
qr_code,
|
| 71 |
target=buffer,
|
| 72 |
+
background=image.filename,
|
| 73 |
kind=image.format,
|
| 74 |
scale=data[scale],
|
| 75 |
light=to_hex_format(data[color_light]),
|
|
|
|
| 93 |
|
| 94 |
gr.on(
|
| 95 |
[
|
| 96 |
+
demo.load,
|
| 97 |
text.submit,
|
| 98 |
background.change,
|
| 99 |
scale.change,
|
myapp/example.webp
ADDED
|