aqlanhadi commited on
Commit
4b31ebb
1 Parent(s): 7bde229

defined params for qr details

Browse files
Files changed (5) hide show
  1. README.md +0 -3
  2. app.py +31 -14
  3. examples/hack.png +0 -3
  4. examples/init.jpeg +0 -3
  5. 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
- qr_code_content: str,
 
 
 
 
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 = 2523992465
76
  sampler = "DPM++ Karras SDE"
77
- init_image = None
78
  qrcode_image = None
79
- use_qr_code_as_init_image = True
 
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("QR Code Content is required")
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="QR Code Content",
131
- info="QR Code Content or URL",
132
- value="",
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
133
  ),
134
  gr.Textbox(
135
  label="Prompt",
136
- info="Prompt that guides the generation towards",
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 = "john.doe@example.com",
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:aqlanhadi.norazman@maybank.com;
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="john.doe@example.com"
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

  • SHA256: 90a2134105ce90eb548541bc22129b7d2766d7a83877d56622c345d73fa6863e
  • Pointer size: 128 Bytes
  • Size of remote file: 123 Bytes
examples/init.jpeg DELETED

Git LFS Details

  • SHA256: ad1a34b26d8204fd1d43dd72e82237dd2f11db940b824de00edfe406d98723df
  • Pointer size: 131 Bytes
  • Size of remote file: 160 kB
examples/qrcode.png DELETED

Git LFS Details

  • SHA256: 82769d9c0bea3e60c53b68ccd03e8e57ef70c46e741d87ae2e5ed71dcf242c2c
  • Pointer size: 129 Bytes
  • Size of remote file: 2.49 kB