Sebastiankay commited on
Commit
2735b22
1 Parent(s): 644675b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +21 -7
app.py CHANGED
@@ -210,6 +210,19 @@ def process(Prompt, used_model, image_width, image_height, image_ratio, image_se
210
  raise gr.Error("Unbekannter Fehler beim API-Aufruf! 🤷‍♂️", duration=15)
211
 
212
 
 
 
 
 
 
 
 
 
 
 
 
 
 
213
  # MARK: Gradio BLOCKS UI
214
  with gr.Blocks(theme=theme, head=custom_head, css=custom_css, js=custom_js, title=title) as demo:
215
  with gr.Row(elem_classes="row-header"):
@@ -231,13 +244,14 @@ with gr.Blocks(theme=theme, head=custom_head, css=custom_css, js=custom_js, titl
231
  with gr.Row(elem_classes="image_size_selctor_wrapper"):
232
  with gr.Column(scale=1):
233
  with gr.Row():
234
- inference_models = ["FLUX-API-OLD"]
235
- selected_model = "FLUX-API-OLD"
236
- models_new_api = ["FLUX", "FLUX-Realism", "FLUX-Pixel", "FLUX-Anime", "FLUX-3D", "FLUX-Disney", "ANY-DARK", "Stable-Diffusion-XL-Base", "Stable-Diffusion-XL-Lightning"]
237
- if check_api(API_V1_IMAGE) == 200:
238
- selected_model = "FLUX"
239
- for model in models_new_api:
240
- inference_models.append(model)
 
241
  select_model = gr.Dropdown(choices=inference_models, value=selected_model, label="Model", elem_id="select_model", elem_classes="select-model")
242
  # with gr.Row():
243
  image_width = gr.Number(label="Breite", minimum=256, maximum=MAX_IMAGE_SIZE, value=576, step=32, elem_id="image_width_selector", elem_classes="image-width-selector", scale=1, visible=False)
 
210
  raise gr.Error("Unbekannter Fehler beim API-Aufruf! 🤷‍♂️", duration=15)
211
 
212
 
213
+ def get_inference_models():
214
+ models = []
215
+ if check_api(API_OLD) == 200:
216
+ models.append("FLUX-API-OLD")
217
+ selected_model = "FLUX-API-OLD"
218
+ if check_api(API_V1_IMAGE) == 200:
219
+ models_new_api = ["FLUX", "FLUX-Realism", "FLUX-Pixel", "FLUX-Anime", "FLUX-3D", "FLUX-Disney", "ANY-DARK", "Stable-Diffusion-XL-Base", "Stable-Diffusion-XL-Lightning"]
220
+ for model in models_new_api:
221
+ models.append(model)
222
+ selected_model = "FLUX"
223
+ return models, selected_model
224
+
225
+
226
  # MARK: Gradio BLOCKS UI
227
  with gr.Blocks(theme=theme, head=custom_head, css=custom_css, js=custom_js, title=title) as demo:
228
  with gr.Row(elem_classes="row-header"):
 
244
  with gr.Row(elem_classes="image_size_selctor_wrapper"):
245
  with gr.Column(scale=1):
246
  with gr.Row():
247
+ inference_models, select_model = get_inference_models()
248
+ # inference_models = ["FLUX-API-OLD"]
249
+ # selected_model = "FLUX-API-OLD"
250
+ # models_new_api = ["FLUX", "FLUX-Realism", "FLUX-Pixel", "FLUX-Anime", "FLUX-3D", "FLUX-Disney", "ANY-DARK", "Stable-Diffusion-XL-Base", "Stable-Diffusion-XL-Lightning"]
251
+ # if check_api(API_V1_IMAGE) == 200:
252
+ # selected_model = "FLUX"
253
+ # for model in models_new_api:
254
+ # inference_models.append(model)
255
  select_model = gr.Dropdown(choices=inference_models, value=selected_model, label="Model", elem_id="select_model", elem_classes="select-model")
256
  # with gr.Row():
257
  image_width = gr.Number(label="Breite", minimum=256, maximum=MAX_IMAGE_SIZE, value=576, step=32, elem_id="image_width_selector", elem_classes="image-width-selector", scale=1, visible=False)