patrickvonplaten commited on
Commit
0b5e97e
1 Parent(s): cbabf63

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -3
app.py CHANGED
@@ -40,8 +40,8 @@ def get_ckpt_names(token, radio_model_names, input_model):
40
  except Exception as e:
41
  return error_str(e), gr.update(choices=[]), None
42
 
43
- def convert_and_push(radio_model_names, input_model, ckpt_name, sd_version, token, path_in_repo):
44
- extract_ema = False
45
 
46
  if sd_version == None:
47
  return error_str("You must select a stable diffusion version.", title="Invalid input")
@@ -132,6 +132,7 @@ with gr.Blocks() as demo:
132
  gr.Markdown("## 2. Convert to Diffusers🧨")
133
  radio_ckpts = gr.Radio(label="Choose the checkpoint to convert", visible=False)
134
  path_in_repo = gr.Textbox(label="Path where the weights will be saved", placeholder="Leave empty for root folder")
 
135
  radio_sd_version = gr.Radio(label="Choose the model version", choices=["v1", "v2", "v2.1"])
136
  gr.Markdown("Conversion may take a few minutes.")
137
  btn_convert = gr.Button("Convert & Push")
@@ -162,7 +163,7 @@ with gr.Blocks() as demo:
162
 
163
  btn_convert.click(
164
  fn=convert_and_push,
165
- inputs=[radio_model_names, input_model, radio_ckpts, radio_sd_version, input_token, path_in_repo],
166
  outputs=error_output,
167
  scroll_to_output=True
168
  )
 
40
  except Exception as e:
41
  return error_str(e), gr.update(choices=[]), None
42
 
43
+ def convert_and_push(radio_model_names, input_model, ckpt_name, sd_version, token, path_in_repo, ema):
44
+ extract_ema = ema == "ema"
45
 
46
  if sd_version == None:
47
  return error_str("You must select a stable diffusion version.", title="Invalid input")
 
132
  gr.Markdown("## 2. Convert to Diffusers🧨")
133
  radio_ckpts = gr.Radio(label="Choose the checkpoint to convert", visible=False)
134
  path_in_repo = gr.Textbox(label="Path where the weights will be saved", placeholder="Leave empty for root folder")
135
+ ema = gr.Radio(label="Extract EMA or non-EMA?", choices=["ema", "non-ema"])
136
  radio_sd_version = gr.Radio(label="Choose the model version", choices=["v1", "v2", "v2.1"])
137
  gr.Markdown("Conversion may take a few minutes.")
138
  btn_convert = gr.Button("Convert & Push")
 
163
 
164
  btn_convert.click(
165
  fn=convert_and_push,
166
+ inputs=[radio_model_names, input_model, radio_ckpts, radio_sd_version, input_token, path_in_repo, ema],
167
  outputs=error_output,
168
  scroll_to_output=True
169
  )