xh365 commited on
Commit
13ebcb9
Β·
1 Parent(s): a65a087

update to simplest version

Browse files
Files changed (1) hide show
  1. app.py +12 -11
app.py CHANGED
@@ -21,7 +21,7 @@ from utils import (
21
  # =========================
22
  CLIP_MODEL = "ViT-H-14"
23
  PRETRAINED_CLIP = "laion2b_s32b_b79k"
24
- default_t2i_model = "black-forest-labs/FLUX.1-schnell" # "black-forest-labs/FLUX.1-dev"
25
  default_llm_model = "deepseek-ai/DeepSeek-R1-Distill-Llama-8B"
26
  MAX_SEED = np.iinfo(np.int32).max
27
  MAX_IMAGE_SIZE = 1024
@@ -46,15 +46,15 @@ responses_memory = {METHOD: {}}
46
 
47
  example_data = [
48
  [
49
- "A futuristic city skyline at sunset",
50
  IMAGES["Tourist promotion"]["ours"]
51
  ],
52
  [
53
- "A fantasy castle in the clouds",
54
  IMAGES["Fictional character generation"]["ours"]
55
  ],
56
  [
57
- "A robot painting a portrait in a studio",
58
  IMAGES["Interior Design"]["ours"]
59
  ],
60
  ]
@@ -251,12 +251,13 @@ css = """
251
  with gr.Blocks(theme=gr.themes.Soft(font=[gr.themes.GoogleFont("Inconsolata"), "Arial", "sans-serif"]), css=css) as demo:
252
  with gr.Column(elem_id="col-container"):
253
  gr.Markdown("# πŸ“Œ **POET**")
254
- instruction = gr.Markdown(" Supporting Prompting Creativity and Personalization with Automated Expansion of Text-to-Image Generation")
 
255
 
256
  with gr.Tab(""):
257
  with gr.Row(elem_id="compact-row"):
258
  prompt = gr.Textbox(
259
- label="🎨 Revise Prompt",
260
  max_lines=5,
261
  placeholder="Enter your prompt",
262
  scale=3,
@@ -269,10 +270,10 @@ with gr.Blocks(theme=gr.themes.Soft(font=[gr.themes.GoogleFont("Inconsolata"), "
269
  images_method = gr.Gallery(label="Images", columns=[4], rows=[1], height=400, elem_id="gallery", format="png")
270
 
271
  with gr.Column(elem_id="col-container3"):
272
- like_image = gr.Image(label="Satisfied Image", width=200, height=200, sources='upload', format="png", type="filepath")
273
- dislike_image = gr.Image(label="Unsatisfied Image", width=200, height=200, sources='upload', format="png", type="filepath")
274
 
275
- with gr.Column(elem_id="col-container2"):
276
  gr.Markdown("### πŸ“ Evaluation")
277
  sim_radio = gr.Radio(
278
  OPTIONS,
@@ -293,7 +294,7 @@ with gr.Blocks(theme=gr.themes.Soft(font=[gr.themes.GoogleFont("Inconsolata"), "
293
  elem_classes=["gradio-radio"]
294
  )
295
 
296
- with gr.Column(elem_id="col-container2"):
297
  example = gr.Examples([['']], prompt, label="Revised Prompt History", visible=False)
298
  history_images = gr.Gallery(label="History Images", columns=[4], rows=[1], elem_id="gallery", format="png")
299
 
@@ -324,7 +325,7 @@ with gr.Blocks(theme=gr.themes.Soft(font=[gr.themes.GoogleFont("Inconsolata"), "
324
  fn=generate_image,
325
  inputs=[prompt, like_image, dislike_image],
326
  outputs=[images_method]
327
- ).success(lambda: [gr.update(interactive=False), gr.update(interactive=False)], outputs=[next_btn, prompt])
328
 
329
  redesign_btn.click(
330
  fn=redesign,
 
21
  # =========================
22
  CLIP_MODEL = "ViT-H-14"
23
  PRETRAINED_CLIP = "laion2b_s32b_b79k"
24
+ default_t2i_model = "black-forest-labs/FLUX.1-dev"
25
  default_llm_model = "deepseek-ai/DeepSeek-R1-Distill-Llama-8B"
26
  MAX_SEED = np.iinfo(np.int32).max
27
  MAX_IMAGE_SIZE = 1024
 
46
 
47
  example_data = [
48
  [
49
+ PROMPTS["Tourist promotion"],
50
  IMAGES["Tourist promotion"]["ours"]
51
  ],
52
  [
53
+ PROMPTS["Fictional character generation"],
54
  IMAGES["Fictional character generation"]["ours"]
55
  ],
56
  [
57
+ PROMPTS["Interior Design"],
58
  IMAGES["Interior Design"]["ours"]
59
  ],
60
  ]
 
251
  with gr.Blocks(theme=gr.themes.Soft(font=[gr.themes.GoogleFont("Inconsolata"), "Arial", "sans-serif"]), css=css) as demo:
252
  with gr.Column(elem_id="col-container"):
253
  gr.Markdown("# πŸ“Œ **POET**")
254
+ instruction = gr.Markdown("Supporting Prompting Creativity with Automated Expansion of Text-to-Image Generation")
255
+ instruction = gr.Markdown("Images generated by POET is more diverse in multiple aspects; e.g., background, race, ...")
256
 
257
  with gr.Tab(""):
258
  with gr.Row(elem_id="compact-row"):
259
  prompt = gr.Textbox(
260
+ label="🎨 Prompt",
261
  max_lines=5,
262
  placeholder="Enter your prompt",
263
  scale=3,
 
270
  images_method = gr.Gallery(label="Images", columns=[4], rows=[1], height=400, elem_id="gallery", format="png")
271
 
272
  with gr.Column(elem_id="col-container3"):
273
+ like_image = gr.Image(label="Satisfied Image", width=200, height=200, sources='upload', format="png", type="filepath", visible=False)
274
+ dislike_image = gr.Image(label="Unsatisfied Image", width=200, height=200, sources='upload', format="png", type="filepath", visible=False)
275
 
276
+ with gr.Column(elem_id="col-container2", visible=False):
277
  gr.Markdown("### πŸ“ Evaluation")
278
  sim_radio = gr.Radio(
279
  OPTIONS,
 
294
  elem_classes=["gradio-radio"]
295
  )
296
 
297
+ with gr.Column(elem_id="col-container2", visible=False):
298
  example = gr.Examples([['']], prompt, label="Revised Prompt History", visible=False)
299
  history_images = gr.Gallery(label="History Images", columns=[4], rows=[1], elem_id="gallery", format="png")
300
 
 
325
  fn=generate_image,
326
  inputs=[prompt, like_image, dislike_image],
327
  outputs=[images_method]
328
+ ).success(lambda: [gr.update(interactive=True), gr.update(interactive=True)], outputs=[next_btn, prompt])
329
 
330
  redesign_btn.click(
331
  fn=redesign,