fffiloni commited on
Commit
ce628e9
1 Parent(s): ebcc343

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -5
app.py CHANGED
@@ -33,15 +33,13 @@ def get_files(file_paths):
33
  return result
34
 
35
  def load_sfts(repo_1_id, repo_2_id):
36
- your_username = api.whoami()["name"]
37
- my_models = api.list_models(author=your_username, filter=["diffusers", "stable-diffusion-xl", 'lora'])
38
- model_names = [item.modelId for item in my_models]
39
- print(model_names)
40
  # List all ".safetensors" files in repos
41
  sfts_available_files_1 = fs.glob(f"{repo_1_id}/*.safetensors")
42
  sfts_available_files_1 = get_files(sfts_available_files_1)
43
  sfts_available_files_2 = fs.glob(f"{repo_2_id}/*.safetensors")
44
  sfts_available_files_2 = get_files(sfts_available_files_2)
 
45
  return gr.update(choices=sfts_available_files_1, value=sfts_available_files_1[0], visible=True), gr.update(choices=sfts_available_files_2, value=sfts_available_files_2[0], visible=True)
46
 
47
  @spaces.GPU
@@ -167,12 +165,17 @@ with gr.Blocks(css=css) as demo:
167
  with gr.Column():
168
 
169
  if is_shared_ui:
 
 
 
 
170
 
 
171
 
172
 
173
  lora_1_id = gr.Dropdown(
174
  label = "LoRa 1 ID",
175
- #choices = my_models,
176
  allow_custom_value = True
177
  #placeholder = "username/model_id"
178
  )
 
33
  return result
34
 
35
  def load_sfts(repo_1_id, repo_2_id):
36
+
 
 
 
37
  # List all ".safetensors" files in repos
38
  sfts_available_files_1 = fs.glob(f"{repo_1_id}/*.safetensors")
39
  sfts_available_files_1 = get_files(sfts_available_files_1)
40
  sfts_available_files_2 = fs.glob(f"{repo_2_id}/*.safetensors")
41
  sfts_available_files_2 = get_files(sfts_available_files_2)
42
+
43
  return gr.update(choices=sfts_available_files_1, value=sfts_available_files_1[0], visible=True), gr.update(choices=sfts_available_files_2, value=sfts_available_files_2[0], visible=True)
44
 
45
  @spaces.GPU
 
165
  with gr.Column():
166
 
167
  if is_shared_ui:
168
+
169
+ your_username = api.whoami()["name"]
170
+ my_models = api.list_models(author=your_username, filter=["diffusers", "stable-diffusion-xl", 'lora'])
171
+ model_names = [item.modelId for item in my_models]
172
 
173
+ #print(model_names)
174
 
175
 
176
  lora_1_id = gr.Dropdown(
177
  label = "LoRa 1 ID",
178
+ choices = my_models,
179
  allow_custom_value = True
180
  #placeholder = "username/model_id"
181
  )