fffiloni commited on
Commit
c5d154d
1 Parent(s): 79ed214

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +24 -12
app.py CHANGED
@@ -126,10 +126,6 @@ div#warning-duplicate .actions a {
126
  display: inline-block;
127
  margin-right: 10px;
128
  }
129
- #prompt{padding: 0 0 1em 0}
130
- #prompt input{width: calc(100% - 160px);border-top-right-radius: 0px;border-bottom-right-radius: 0px;}
131
- #run_button{position: absolute;margin-top: 25.8px;right: 0;margin-right: 0.75em;border-bottom-left-radius: 0px;border-top-left-radius: 0px}
132
- #prompt_area .form{border:0}
133
  """
134
 
135
  with gr.Blocks(css=css) as demo:
@@ -192,11 +188,27 @@ with gr.Blocks(css=css) as demo:
192
  )
193
 
194
  with gr.Column():
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
195
 
196
- lora_2_id = gr.Textbox(
197
- label = "LoRa 2 ID",
198
- placeholder = "username/model_id"
199
- )
 
200
 
201
  lora_2_sfts = gr.Dropdown(
202
  label = "Safetensors file",
@@ -206,17 +218,17 @@ with gr.Blocks(css=css) as demo:
206
  load_models_btn = gr.Button("Load models and .safetensors")
207
 
208
  # PART 2 • INFERENCE
209
- with gr.Box():
210
- with gr.Row(elem_id="prompt-area"):
211
 
212
  prompt = gr.Textbox(
213
  label = "Your prompt",
214
- show_label = False,
215
  info = "Use your trigger words into a coherent prompt",
216
  placeholder = "e.g: a triggerWordOne portrait in triggerWord2 style"
217
  )
218
 
219
- run_btn = gr.Button("Run", elem_id="run_button")
220
 
221
  output_image = gr.Image(
222
  label = "Output"
 
126
  display: inline-block;
127
  margin-right: 10px;
128
  }
 
 
 
 
129
  """
130
 
131
  with gr.Blocks(css=css) as demo:
 
188
  )
189
 
190
  with gr.Column():
191
+
192
+ if not is_shared_ui:
193
+
194
+ your_username = api.whoami()["name"]
195
+ my_models = api.list_models(author=your_username, filter=["diffusers", "stable-diffusion-xl", 'lora'])
196
+ model_names = [item.modelId for item in my_models]
197
+
198
+ #print(model_names)
199
+
200
+ lora_2_id = gr.Dropdown(
201
+ label = "LoRa 2 ID",
202
+ choices = model_names,
203
+ allow_custom_value = True
204
+ #placeholder = "username/model_id"
205
+ )
206
 
207
+ else:
208
+ lora_2_id = gr.Textbox(
209
+ label = "LoRa 2 ID",
210
+ placeholder = "username/model_id"
211
+ )
212
 
213
  lora_2_sfts = gr.Dropdown(
214
  label = "Safetensors file",
 
218
  load_models_btn = gr.Button("Load models and .safetensors")
219
 
220
  # PART 2 • INFERENCE
221
+ with gr.Column():
222
+ with gr.Row():
223
 
224
  prompt = gr.Textbox(
225
  label = "Your prompt",
226
+ show_label = True,
227
  info = "Use your trigger words into a coherent prompt",
228
  placeholder = "e.g: a triggerWordOne portrait in triggerWord2 style"
229
  )
230
 
231
+ run_btn = gr.Button("Run", elem_id="run_button")
232
 
233
  output_image = gr.Image(
234
  label = "Output"