update
Browse files
app.py
CHANGED
@@ -174,11 +174,14 @@ t2i_default_img_path_list = []
|
|
174 |
import base64, requests
|
175 |
from io import BytesIO
|
176 |
from PIL import Image
|
177 |
-
def
|
|
|
|
|
|
|
178 |
try:
|
179 |
res = requests.get(f"https://www.clueai.cn/clueai/hf_text2image?text={text}&negative_prompt={n_text}\
|
180 |
&guidance_scale={guidance_scale}&num_inference_steps={steps}\
|
181 |
-
&style={style}&shape={shape}&clarity={clarity}&shape_scale={shape_scale}")
|
182 |
except Exception as e:
|
183 |
logger.error(f"error, {e}")
|
184 |
return
|
@@ -255,7 +258,7 @@ with gr.Blocks(css=css, title="ClueAI") as demo:
|
|
255 |
)
|
256 |
|
257 |
input_params = [text, n_text, guidance_scale, style, shape, clarity, steps, shape_scale]
|
258 |
-
generate_prompt_btn.click(
|
259 |
text.submit(inference_image, inputs=input_params, outputs=t2i_gallery)
|
260 |
btn.click(inference_image, inputs=input_params, outputs=t2i_gallery)
|
261 |
|
|
|
174 |
import base64, requests
|
175 |
from io import BytesIO
|
176 |
from PIL import Image
|
177 |
+
def luck_inference_image(text, n_text, guidance_scale, style, shape, clarity, steps, shape_scale):
|
178 |
+
return inference_image(text, n_text, guidance_scale, style, shape, clarity, steps, shape_scale, luck=True)
|
179 |
+
|
180 |
+
def inference_image(text, n_text, guidance_scale, style, shape, clarity, steps, shape_scale, luck=False):
|
181 |
try:
|
182 |
res = requests.get(f"https://www.clueai.cn/clueai/hf_text2image?text={text}&negative_prompt={n_text}\
|
183 |
&guidance_scale={guidance_scale}&num_inference_steps={steps}\
|
184 |
+
&style={style}&shape={shape}&clarity={clarity}&shape_scale={shape_scale}&luck={luck}")
|
185 |
except Exception as e:
|
186 |
logger.error(f"error, {e}")
|
187 |
return
|
|
|
258 |
)
|
259 |
|
260 |
input_params = [text, n_text, guidance_scale, style, shape, clarity, steps, shape_scale]
|
261 |
+
generate_prompt_btn.click(luck_inference_image, inputs=input_params, outputs=[t2i_gallery])
|
262 |
text.submit(inference_image, inputs=input_params, outputs=t2i_gallery)
|
263 |
btn.click(inference_image, inputs=input_params, outputs=t2i_gallery)
|
264 |
|