Abdullah-Habib commited on
Commit
2b5f98f
·
1 Parent(s): 05fd8e7

removed lora selection

Browse files
Files changed (1) hide show
  1. app.py +14 -14
app.py CHANGED
@@ -39,11 +39,11 @@ def update_selection(evt: gr.SelectData):
39
  )
40
 
41
  @spaces.GPU
42
- def run_lora(prompt, negative_prompt, cfg_scale, steps, selected_index, scheduler, seed, width, height, lora_scale):
43
  if selected_index is None:
44
  raise gr.Error("You must select a LoRA before proceeding.")
45
 
46
- selected_lora = loras[selected_index]
47
  # lora_path = selected_lora["repo"]
48
  # trigger_word = selected_lora["trigger_word"]
49
 
@@ -93,7 +93,7 @@ def run_lora(prompt, negative_prompt, cfg_scale, steps, selected_index, schedule
93
 
94
  # Generate image
95
  image = pipe(
96
- prompt=f"{prompt} logo, logoredmaf, icons",
97
  negative_prompt=negative_prompt,
98
  num_inference_steps=steps,
99
  guidance_scale=cfg_scale,
@@ -117,19 +117,19 @@ with gr.Blocks(theme=gr.themes.Soft()) as app:
117
  result = gr.Image(label="Generated Image", height=768)
118
  generate_button = gr.Button("Generate", variant="primary")
119
 
120
- with gr.Column(scale=1):
121
- gallery = gr.Gallery(
122
- [(item["image"], item["title"]) for item in loras],
123
- label="LoRA Gallery",
124
- allow_preview=False,
125
- columns=2
126
- )
127
 
128
  with gr.Row():
129
  with gr.Column():
130
- prompt_title = gr.Markdown("### Click on a LoRA in the gallery to select it")
131
  selected_info = gr.Markdown("")
132
- prompt = gr.Textbox(label="Prompt", lines=3, placeholder="Type a prompt after selecting a LoRA")
133
  negative_prompt = gr.Textbox(label="Negative Prompt", lines=2, value="low quality, bad anatomy, bad hands, text, error, missing fingers, extra digit, fewer digits, cropped, worst quality, low quality, normal quality, jpeg artifacts, signature, watermark, username, blurry")
134
 
135
  with gr.Column():
@@ -155,11 +155,11 @@ with gr.Blocks(theme=gr.themes.Soft()) as app:
155
  value="DPM++ 2M SDE Karras"
156
  )
157
 
158
- gallery.select(update_selection, outputs=[prompt, selected_info, selected_index])
159
 
160
  generate_button.click(
161
  fn=run_lora,
162
- inputs=[prompt, negative_prompt, cfg_scale, steps, selected_index, scheduler, seed, width, height, lora_scale],
163
  outputs=[result]
164
  )
165
 
 
39
  )
40
 
41
  @spaces.GPU
42
+ def run_lora(prompt, negative_prompt, cfg_scale, steps, scheduler, seed, width, height, lora_scale):
43
  if selected_index is None:
44
  raise gr.Error("You must select a LoRA before proceeding.")
45
 
46
+ # selected_lora = loras[selected_index]
47
  # lora_path = selected_lora["repo"]
48
  # trigger_word = selected_lora["trigger_word"]
49
 
 
93
 
94
  # Generate image
95
  image = pipe(
96
+ prompt=f"{prompt}, rounded square, logo, logoredmaf, icons",
97
  negative_prompt=negative_prompt,
98
  num_inference_steps=steps,
99
  guidance_scale=cfg_scale,
 
117
  result = gr.Image(label="Generated Image", height=768)
118
  generate_button = gr.Button("Generate", variant="primary")
119
 
120
+ # with gr.Column(scale=1):
121
+ # gallery = gr.Gallery(
122
+ # [(item["image"], item["title"]) for item in loras],
123
+ # label="LoRA Gallery",
124
+ # allow_preview=False,
125
+ # columns=2
126
+ # )
127
 
128
  with gr.Row():
129
  with gr.Column():
130
+ prompt_title = ""
131
  selected_info = gr.Markdown("")
132
+ prompt = gr.Textbox(label="Prompt", lines=3, placeholder="Please enter a prompt")
133
  negative_prompt = gr.Textbox(label="Negative Prompt", lines=2, value="low quality, bad anatomy, bad hands, text, error, missing fingers, extra digit, fewer digits, cropped, worst quality, low quality, normal quality, jpeg artifacts, signature, watermark, username, blurry")
134
 
135
  with gr.Column():
 
155
  value="DPM++ 2M SDE Karras"
156
  )
157
 
158
+ # gallery.select(update_selection, outputs=[prompt, selected_info, selected_index])
159
 
160
  generate_button.click(
161
  fn=run_lora,
162
+ inputs=[prompt, negative_prompt, cfg_scale, steps, scheduler, seed, width, height, lora_scale],
163
  outputs=[result]
164
  )
165