Spaces:
Nymbo
/
Running on CPU Upgrade

Rooni commited on
Commit
03064f6
1 Parent(s): 851f478

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -9
app.py CHANGED
@@ -13,7 +13,7 @@ headers = {"Authorization": f"Bearer {API_TOKEN}"}
13
 
14
  models_list = ["AbsoluteReality 1.8.1", "DALL-E 3 XL", "Playground 2", "Openjourney 4", "Lyriel 1.6", "Animagine XL 2.0", "Counterfeit 2.5", "Realistic Vision 5.1", "Incursios 1.6", "Anime Detailer XL", "Vector Art XL", "epiCRealism", "PixelArt XL", "NewReality XL", "Anything 5.0", "PixArt XL 2.0", "Disney Cartoon", "CleanLinearMix", "Waifu 1.4"]
15
 
16
- def query(prompt, model, is_negative=False, steps=30, cfg_scale=7, sampler="DPM++ 2M Karras", seed=-1, width=512, height=512):
17
  if prompt == "" or prompt == None:
18
  return None
19
 
@@ -72,11 +72,7 @@ def query(prompt, model, is_negative=False, steps=30, cfg_scale=7, sampler="DPM+
72
  "is_negative": is_negative,
73
  "steps": steps,
74
  "cfg_scale": cfg_scale,
75
- "seed": seed if seed != -1 else random.randint(1, 1000000000),
76
- "size": {
77
- "width": width,
78
- "height": height
79
- }
80
  }
81
 
82
  image_bytes = requests.post(API_URL, headers=headers, json=payload).content
@@ -110,19 +106,19 @@ with gr.Blocks(css=css) as dalle:
110
  method = gr.Radio(label="Sampling method", value="DPM++ 2M Karras", choices=["DPM++ 2M Karras", "DPM++ SDE Karras", "Euler", "Euler a", "Heun", "DDIM"])
111
  with gr.Row():
112
  seed = gr.Slider(label="Seed", value=-1, minimum=-1, maximum=1000000000, step=1)
113
-
114
  with gr.Tab("Beta"):
115
  with gr.Row():
116
  width = gr.Slider(label="Ширина", value=512, minimum=15, maximum=1024, step=1)
117
  height = gr.Slider(label="Длина", value=512, minimum=15, maximum=1024, step=1)
118
 
119
-
120
 
121
  with gr.Row():
122
  text_button = gr.Button("Генерация", variant='primary', elem_id="gen-button")
123
  with gr.Row():
124
  image_output = gr.Image(type="pil", label="Изображение", elem_id="gallery")
125
 
126
- text_button.click(query, inputs=[text_prompt, model, negative_prompt, steps, cfg, method, seed, width, height], outputs=image_output)
127
 
128
  dalle.launch(show_api=False, share=False)
 
13
 
14
  models_list = ["AbsoluteReality 1.8.1", "DALL-E 3 XL", "Playground 2", "Openjourney 4", "Lyriel 1.6", "Animagine XL 2.0", "Counterfeit 2.5", "Realistic Vision 5.1", "Incursios 1.6", "Anime Detailer XL", "Vector Art XL", "epiCRealism", "PixelArt XL", "NewReality XL", "Anything 5.0", "PixArt XL 2.0", "Disney Cartoon", "CleanLinearMix", "Waifu 1.4"]
15
 
16
+ def query(prompt, model, is_negative=False, steps=30, cfg_scale=7, sampler="DPM++ 2M Karras", seed=-1):
17
  if prompt == "" or prompt == None:
18
  return None
19
 
 
72
  "is_negative": is_negative,
73
  "steps": steps,
74
  "cfg_scale": cfg_scale,
75
+ "seed": seed if seed != -1 else random.randint(1, 1000000000)
 
 
 
 
76
  }
77
 
78
  image_bytes = requests.post(API_URL, headers=headers, json=payload).content
 
106
  method = gr.Radio(label="Sampling method", value="DPM++ 2M Karras", choices=["DPM++ 2M Karras", "DPM++ SDE Karras", "Euler", "Euler a", "Heun", "DDIM"])
107
  with gr.Row():
108
  seed = gr.Slider(label="Seed", value=-1, minimum=-1, maximum=1000000000, step=1)
109
+ """
110
  with gr.Tab("Beta"):
111
  with gr.Row():
112
  width = gr.Slider(label="Ширина", value=512, minimum=15, maximum=1024, step=1)
113
  height = gr.Slider(label="Длина", value=512, minimum=15, maximum=1024, step=1)
114
 
115
+ """
116
 
117
  with gr.Row():
118
  text_button = gr.Button("Генерация", variant='primary', elem_id="gen-button")
119
  with gr.Row():
120
  image_output = gr.Image(type="pil", label="Изображение", elem_id="gallery")
121
 
122
+ text_button.click(query, inputs=[text_prompt, model, negative_prompt, steps, cfg, method, seed], outputs=image_output)
123
 
124
  dalle.launch(show_api=False, share=False)