throaway2854 commited on
Commit
e8f0231
1 Parent(s): 80c0c14

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -5
app.py CHANGED
@@ -138,9 +138,9 @@ def create_ui():
138
  output = gr.Textbox(label="Generated Prompt", lines=5)
139
 
140
  with gr.Row():
141
- for char_name, char_data in data["characters"].items():
142
- if char_data["image"]:
143
- gr.Image(value=char_data["image"], label=char_name, height=100, width=100)
144
 
145
  with gr.TabItem("Character Creation"):
146
  with gr.Row():
@@ -151,7 +151,7 @@ def create_ui():
151
  create_char_button = gr.Button("Create/Update Character")
152
 
153
  with gr.Column():
154
- char_gallery = gr.Gallery(label="Existing Characters", show_label=False, elem_id="char_gallery").style(grid=2, height="auto")
155
 
156
  def update_and_generate(*args):
157
  nonlocal data
@@ -178,7 +178,8 @@ def create_ui():
178
  )
179
 
180
  def update_char_gallery():
181
- return gr.Gallery(value=[char_data["image"] for char_data in data["characters"].values() if char_data["image"]])
 
182
 
183
  create_char_button.click(
184
  create_character,
 
138
  output = gr.Textbox(label="Generated Prompt", lines=5)
139
 
140
  with gr.Row():
141
+ char_images = [char_data["image"] for char_data in data["characters"].values() if char_data["image"]]
142
+ char_names = [char_name for char_name, char_data in data["characters"].items() if char_data["image"]]
143
+ gr.Gallery(value=char_images, label="Character Images", show_label=True, elem_id="char_gallery", columns=2, rows=2, height="auto")
144
 
145
  with gr.TabItem("Character Creation"):
146
  with gr.Row():
 
151
  create_char_button = gr.Button("Create/Update Character")
152
 
153
  with gr.Column():
154
+ char_gallery = gr.Gallery(label="Existing Characters", show_label=True, elem_id="char_gallery", columns=2, rows=2, height="auto")
155
 
156
  def update_and_generate(*args):
157
  nonlocal data
 
178
  )
179
 
180
  def update_char_gallery():
181
+ char_images = [char_data["image"] for char_data in data["characters"].values() if char_data["image"]]
182
+ return gr.Gallery(value=char_images)
183
 
184
  create_char_button.click(
185
  create_character,