zenafey commited on
Commit
d276473
1 Parent(s): 08e6691

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -3
app.py CHANGED
@@ -15,6 +15,9 @@ import html
15
  import re
16
  from threading import Thread
17
 
 
 
 
18
  class Prodia:
19
  def __init__(self, api_key, base=None):
20
  self.base = base or "https://api.prodia.com/v1"
@@ -102,7 +105,7 @@ def place_lora(current_prompt, lorabtn):
102
  if f"<lora:{lorabtn}:1.0>" in current_prompt:
103
  result = current_prompt.replace(f"<lora:{lorabtn}:1.0>", "")
104
  else:
105
- result = f"{current_prompt}, <lora:{lorabtn}:1.0>"
106
  return result
107
 
108
  def create_grid(image_urls):
@@ -340,8 +343,8 @@ with gr.Blocks(css=css) as demo:
340
  loralist = prodia_client.list_loras()
341
  with gr.Row():
342
  for lora in loralist:
343
- lora_btn = gr.Button(lora)
344
- lora_btn.click(place_lora, inputs=[lora_btn], outputs=prompt)
345
 
346
  with gr.Column(scale=2):
347
  image_output = gr.Gallery(value=["https://images.prodia.xyz/8ede1a7c-c0ee-4ded-987d-6ffed35fc477.png"], preview=True)
 
15
  import re
16
  from threading import Thread
17
 
18
+ from dotenv import load_dotenv
19
+ load_dotenv()
20
+
21
  class Prodia:
22
  def __init__(self, api_key, base=None):
23
  self.base = base or "https://api.prodia.com/v1"
 
105
  if f"<lora:{lorabtn}:1.0>" in current_prompt:
106
  result = current_prompt.replace(f"<lora:{lorabtn}:1.0>", "")
107
  else:
108
+ result = f"{current_prompt} <lora:{lorabtn}:1>"
109
  return result
110
 
111
  def create_grid(image_urls):
 
343
  loralist = prodia_client.list_loras()
344
  with gr.Row():
345
  for lora in loralist:
346
+ lora_btn = gr.Button(lora, size="sm")
347
+ lora_btn.click(place_lora, inputs=[prompt, lora_btn], outputs=prompt)
348
 
349
  with gr.Column(scale=2):
350
  image_output = gr.Gallery(value=["https://images.prodia.xyz/8ede1a7c-c0ee-4ded-987d-6ffed35fc477.png"], preview=True)