dreamdrop-art commited on
Commit
dda9682
1 Parent(s): 90c9c61

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -3
app.py CHANGED
@@ -22,6 +22,7 @@ def query(payload, model):
22
 
23
  def hf_inference(prompt, negative, model, steps, sampler, guidance, width, height, seed):
24
  try:
 
25
  image_bytes = query(payload={
26
  "inputs": f"{prompt}",
27
  "parameters": {
@@ -33,7 +34,8 @@ def hf_inference(prompt, negative, model, steps, sampler, guidance, width, heigh
33
  },
34
  }, model=model)
35
  image = Image.open(io.BytesIO(image_bytes))
36
- return image
 
37
  except PIL.UnidentifiedImageError:
38
  gr.Warning("This model is not loaded now. Try others models.")
39
 
@@ -368,7 +370,8 @@ with gr.Blocks(css=css) as demo:
368
  concurrency_limit=64)
369
  with gr.Tab("HuggingFace Inference"):
370
  with gr.Row():
371
- hf_model = gr.Dropdown(label="HuggingFace checkpoint", choices=["runwayml/stable-diffusion-v1-5", "stabilityai/stable-diffusion-2-1", "dataautogpt3/OpenDalleV1.1", "CompVis/stable-diffusion-v1-4", "playgroundai/playground-v2-1024px-aesthetic", "prompthero/openjourney", "openskyml/dreamdrop-v1", "SG161222/Realistic_Vision_V1.4", "digiplay/AbsoluteReality_v1.8.1", "openskyml/dalle-3-xl", "Lykon/dreamshaper-7", "Pclanglais/Mickey-1928"], value="runwayml/stable-diffusion-v1-5", allow_custom_value=False, interactive=True)
 
372
  with gr.Row():
373
  with gr.Column(scale=6, min_width=600):
374
  hf_prompt = gr.Textbox("space warrior, beautiful, female, ultrarealistic, soft lighting, 8k",
@@ -399,7 +402,7 @@ with gr.Blocks(css=css) as demo:
399
  hf_seed = gr.Number(label="Seed", value=-1)
400
 
401
  with gr.Column(scale=2):
402
- hf_image_output = gr.Image(show_label=False, type="pil", interactive=False)
403
  #hf_send_to_img2img = gr.Button(value="Send to img2img")
404
 
405
  hf_text_button.click(hf_inference, inputs=[hf_prompt, hf_negative_prompt, hf_model, hf_steps, sampler, hf_cfg_scale, hf_width, hf_height,
 
22
 
23
  def hf_inference(prompt, negative, model, steps, sampler, guidance, width, height, seed):
24
  try:
25
+ images=[]
26
  image_bytes = query(payload={
27
  "inputs": f"{prompt}",
28
  "parameters": {
 
34
  },
35
  }, model=model)
36
  image = Image.open(io.BytesIO(image_bytes))
37
+ images.append(image)
38
+ return images
39
  except PIL.UnidentifiedImageError:
40
  gr.Warning("This model is not loaded now. Try others models.")
41
 
 
370
  concurrency_limit=64)
371
  with gr.Tab("HuggingFace Inference"):
372
  with gr.Row():
373
+ gr.Markdown("Add your model from HF.co, enter model ID.")
374
+ hf_model = gr.Dropdown(label="HuggingFace checkpoint", choices=["runwayml/stable-diffusion-v1-5", "stabilityai/stable-diffusion-2-1", "dataautogpt3/OpenDalleV1.1", "CompVis/stable-diffusion-v1-4", "playgroundai/playground-v2-1024px-aesthetic", "prompthero/openjourney", "openskyml/dreamdrop-v1", "SG161222/Realistic_Vision_V1.4", "digiplay/AbsoluteReality_v1.8.1", "openskyml/dalle-3-xl", "Lykon/dreamshaper-7", "Pclanglais/Mickey-1928"], value="runwayml/stable-diffusion-v1-5", allow_custom_value=True, interactive=True)
375
  with gr.Row():
376
  with gr.Column(scale=6, min_width=600):
377
  hf_prompt = gr.Textbox("space warrior, beautiful, female, ultrarealistic, soft lighting, 8k",
 
402
  hf_seed = gr.Number(label="Seed", value=-1)
403
 
404
  with gr.Column(scale=2):
405
+ hf_image_output = gr.Gallery(show_label=False, preview=True, columns=4, allow_preview=True)
406
  #hf_send_to_img2img = gr.Button(value="Send to img2img")
407
 
408
  hf_text_button.click(hf_inference, inputs=[hf_prompt, hf_negative_prompt, hf_model, hf_steps, sampler, hf_cfg_scale, hf_width, hf_height,