defined params for qr details
Browse files- README.md +0 -3
- app.py +31 -14
- examples/hack.png +0 -3
- examples/init.jpeg +0 -3
- examples/qrcode.png +0 -3
README.md
CHANGED
@@ -9,7 +9,4 @@ app_file: app.py
|
|
9 |
pinned: false
|
10 |
suggested_hardware: t4-medium
|
11 |
startup_duration_timeout: 1h
|
12 |
-
duplicated_from: huggingface-projects/QR-code-AI-art-generator
|
13 |
---
|
14 |
-
|
15 |
-
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
9 |
pinned: false
|
10 |
suggested_hardware: t4-medium
|
11 |
startup_duration_timeout: 1h
|
|
|
12 |
---
|
|
|
|
app.py
CHANGED
@@ -62,27 +62,30 @@ SAMPLER_MAP = {
|
|
62 |
}
|
63 |
|
64 |
|
|
|
65 |
def inference(
|
66 |
-
|
|
|
|
|
|
|
|
|
67 |
prompt: str = "Sky view of highly aesthetic, ancient greek thermal baths in beautiful nature",
|
68 |
negative_prompt: str = "ugly, disfigured, low quality, blurry, nsfw",
|
69 |
-
|
70 |
):
|
71 |
-
|
72 |
guidance_scale = 7.5
|
73 |
controlnet_conditioning_scale = 1.5
|
74 |
strength = 0.9
|
75 |
-
seed =
|
76 |
sampler = "DPM++ Karras SDE"
|
77 |
-
init_image = None
|
78 |
qrcode_image = None
|
79 |
-
|
|
|
80 |
|
81 |
if prompt is None or prompt == "":
|
82 |
raise gr.Error("Prompt is required")
|
83 |
|
84 |
if qr_code_content == "":
|
85 |
-
raise gr.Error("
|
86 |
|
87 |
pipe.scheduler = SAMPLER_MAP[sampler](pipe.scheduler.config)
|
88 |
|
@@ -105,9 +108,6 @@ def inference(
|
|
105 |
print("Using QR Code Image")
|
106 |
qrcode_image = resize_for_condition_image(qrcode_image, 768)
|
107 |
|
108 |
-
# hack due to gradio examples
|
109 |
-
init_image = qrcode_image
|
110 |
-
|
111 |
out = pipe(
|
112 |
prompt=prompt,
|
113 |
negative_prompt=negative_prompt,
|
@@ -123,17 +123,34 @@ def inference(
|
|
123 |
)
|
124 |
return out.images[0] # type: ignore
|
125 |
|
|
|
|
|
126 |
generator = gr.Interface(
|
127 |
fn=inference,
|
128 |
inputs=[
|
129 |
gr.Textbox(
|
130 |
-
label="
|
131 |
-
|
132 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
133 |
),
|
134 |
gr.Textbox(
|
135 |
label="Prompt",
|
136 |
-
|
137 |
),
|
138 |
gr.Textbox(
|
139 |
label="Negative Prompt",
|
|
|
62 |
}
|
63 |
|
64 |
|
65 |
+
|
66 |
def inference(
|
67 |
+
first_name: str = "John",
|
68 |
+
last_name: str = "Doe",
|
69 |
+
telephone_number: str = "+60123456789",
|
70 |
+
email_address: str = "[email protected]",
|
71 |
+
url: str = "https://example.com",
|
72 |
prompt: str = "Sky view of highly aesthetic, ancient greek thermal baths in beautiful nature",
|
73 |
negative_prompt: str = "ugly, disfigured, low quality, blurry, nsfw",
|
|
|
74 |
):
|
|
|
75 |
guidance_scale = 7.5
|
76 |
controlnet_conditioning_scale = 1.5
|
77 |
strength = 0.9
|
78 |
+
seed = -1
|
79 |
sampler = "DPM++ Karras SDE"
|
|
|
80 |
qrcode_image = None
|
81 |
+
|
82 |
+
qr_code_content = f"MECARD:N:{last_name},{first_name};TEL:{telephone_number};EMAIL:{email_address};URL:{url};"
|
83 |
|
84 |
if prompt is None or prompt == "":
|
85 |
raise gr.Error("Prompt is required")
|
86 |
|
87 |
if qr_code_content == "":
|
88 |
+
raise gr.Error("Content is required")
|
89 |
|
90 |
pipe.scheduler = SAMPLER_MAP[sampler](pipe.scheduler.config)
|
91 |
|
|
|
108 |
print("Using QR Code Image")
|
109 |
qrcode_image = resize_for_condition_image(qrcode_image, 768)
|
110 |
|
|
|
|
|
|
|
111 |
out = pipe(
|
112 |
prompt=prompt,
|
113 |
negative_prompt=negative_prompt,
|
|
|
123 |
)
|
124 |
return out.images[0] # type: ignore
|
125 |
|
126 |
+
# MECARD:N:Aqlan Nor Azman;TEL:60173063421;EMAIL:[email protected];
|
127 |
+
|
128 |
generator = gr.Interface(
|
129 |
fn=inference,
|
130 |
inputs=[
|
131 |
gr.Textbox(
|
132 |
+
label="First Name",
|
133 |
+
value="John",
|
134 |
+
),
|
135 |
+
gr.Textbox(
|
136 |
+
label="Last Name",
|
137 |
+
value="Doe",
|
138 |
+
),
|
139 |
+
gr.Textbox(
|
140 |
+
label="Telephone Number",
|
141 |
+
value="+60123456789",
|
142 |
+
),
|
143 |
+
gr.Textbox(
|
144 |
+
label="Email Address",
|
145 |
+
value="[email protected]"
|
146 |
+
),
|
147 |
+
gr.Textbox(
|
148 |
+
label="URL",
|
149 |
+
value="https://example.com",
|
150 |
),
|
151 |
gr.Textbox(
|
152 |
label="Prompt",
|
153 |
+
value="Sky view of highly aesthetic, ancient greek thermal baths in beautiful nature",
|
154 |
),
|
155 |
gr.Textbox(
|
156 |
label="Negative Prompt",
|
examples/hack.png
DELETED
Git LFS Details
|
examples/init.jpeg
DELETED
Git LFS Details
|
examples/qrcode.png
DELETED
Git LFS Details
|