patrickvonplaten commited on
Commit
114611c
β€’
1 Parent(s): a1406a7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +30 -19
app.py CHANGED
@@ -27,29 +27,33 @@ LINKS = {
27
  "karlo": "https://huggingface.co/kakaobrain/karlo-v1-alpha",
28
  }
29
  SD_1_5_RESULT = """
 
30
  ![img](https://huggingface.co/datasets/OpenGenAI/logos/blob/main/37351293.png)
31
- "The traditional one πŸ”₯! You mostly resonate with **Stable Diffusion 1-5** released by RunwayML.
32
  \n Stable Diffusion 1-5 is the most used open-source text-to-image model offering an amazing speed-to-image-quality trade-off!
33
- Check out your soulmate [here](https://huggingface.co/runwayml/stable-diffusion-v1-5).
34
  """
35
  SD_2_1_RESULT = """
 
36
  ![img](https://huggingface.co/datasets/OpenGenAI/logos/resolve/main/7vmYr2XwVcPtkLzac_jxQ.png)
37
- "The creative one 🎨! You mostly resonate with **Stable Diffusion 2-1** released by Stability AI.
38
  \n Stable Diffusion 2-1 is the latest open-source release of Stable Diffusion and allows to render stunning images of much larger sizes than Stable Diffusion v1.
39
  Try it out [here](https://huggingface.co/stabilityai/stable-diffusion-2-1).
40
  """
41
  IF_V1_0 = """
 
42
  ![img](https://huggingface.co/datasets/OpenGenAI/logos/blob/main/1662453741854-63170739dc97a974718be2c7.png)
43
- The powerful one ⚑! You mostly resonate with **IF v1-0** released by DeepFloyd.
44
  \n IF v1-0 is by far the largest of the open-sourced text-to-image models and is a very powerful image generator.
45
- Besides being able to generate multiple complex concepts in the same image, IF v1-0 is also extremely good at generating text in images.
46
- Check out your new best friend [here](https://huggingface.co/DeepFloyd/IF-I-XL-v1.0)
47
  """
48
  KARLO = """
 
49
  ![img](https://huggingface.co/datasets/OpenGenAI/logos/blob/main/1670220967262-615ed619c807b26d117a49bd.png)
50
- The precise one 🎯! You mostly resonate with **Karlo** released by KakaoBrain.
51
  \n Karlo is based on the same architecture as DALLE-2 and has been trained on the [well curated COYO dataset](https://huggingface.co/datasets/kakaobrain/coyo-700m).
52
- Play around with it [here]("https://huggingface.co/kakaobrain/karlo-v1-alpha").
53
  """
54
 
55
  RESULT = {
@@ -199,9 +203,10 @@ def change_view(row_number, dataframe):
199
 
200
  dataset.push_to_hub(repo_id, token=os.getenv("HF_TOKEN"))
201
  return {
202
- intro_view: gr.update(visible=True),
203
  result_view: gr.update(visible=True),
204
  gallery_view: gr.update(visible=False),
 
205
  result: RESULT[favorite_model],
206
  }
207
  else:
@@ -209,6 +214,7 @@ def change_view(row_number, dataframe):
209
  intro_view: gr.update(visible=False),
210
  result_view: gr.update(visible=False),
211
  gallery_view: gr.update(visible=True),
 
212
  result: "",
213
  }
214
 
@@ -216,9 +222,10 @@ def change_view(row_number, dataframe):
216
  TITLE = "# What's Your AI Gen Personality 🧬?"
217
 
218
  DESCRIPTION = """
219
- *In this interactive game you are shown image descriptions along side 4 AI generated images. Select the image that best fits the image description.
220
- Answer **10** questions to find out what AI generator most resonates with you. If none of the images fit the prompt, choose the image that comes closest
221
- in your opinion.* \n\n
 
222
  """
223
  EXPLANATION = """\n\n
224
  ## What to do πŸ“– \n\n
@@ -227,23 +234,23 @@ EXPLANATION = """\n\n
227
  2. A prompt and 4 different images are displayed
228
  3. Select your favorite image
229
  4. After 10 rounds your favorite diffusion model is displayed \n\n
230
-
231
- *The prompts you are shown originate from the [Parti Prompts](https://huggingface.co/datasets/nateraw/parti-prompts) dataset.
 
232
  Parti Prompts is designed to test text-to-image AI models on 1600+ prompts of varying difficulty and categories.
233
  The images you are shown have been pre-generated with 4 state-of-the-art open-sourced text-to-image models. \n\n
234
  You answers will be used to contribute to the official [**Open Parti Prompts Leaderboard**](https://huggingface.co/spaces/OpenGenAI/parti-prompts-leaderboard). \n
235
  By playing this game, you are greatly helping the community to have a better, **human-preference-aligned** metric to compare text-to-image models ❀️. \n\n
236
- Every month, the generated images will be updated with possibly improved models.*
237
  """
238
 
239
  GALLERY_COLUMN_NUM = len(SUBMISSIONS)
240
 
241
  with gr.Blocks() as demo:
 
242
  with gr.Column(visible=True) as intro_view:
243
- gr.Markdown(TITLE)
244
  gr.Markdown(DESCRIPTION)
245
  gr.Markdown(EXPLANATION)
246
- start_button = gr.Button("Start").style(full_width=False)
247
 
248
  headers = ["prompt", "result", "id", "Challenge", "Category", "Note"] + [
249
  f"choice_{i}" for i in range(len(SUBMISSIONS))
@@ -272,6 +279,10 @@ with gr.Blocks() as demo:
272
  )
273
  gr.Markdown("Click on start to play again!")
274
 
 
 
 
 
275
  with gr.Column(visible=False):
276
  selected_image = gr.Number(label="Selected index", value=-1, precision=0)
277
 
@@ -307,7 +318,7 @@ with gr.Blocks() as demo:
307
  ).then(
308
  fn=change_view,
309
  inputs=[row_number, dataframe],
310
- outputs=[intro_view, result_view, gallery_view, result]
311
  ).then(
312
  fn=process, inputs=[dataframe], outputs=[image_1, image_2, image_3, image_4, prompt, counter]
313
  )
@@ -325,7 +336,7 @@ with gr.Blocks() as demo:
325
  ).then(
326
  fn=change_view,
327
  inputs=[row_number, dataframe],
328
- outputs=[intro_view, result_view, gallery_view, result]
329
  ).then(
330
  fn=process,
331
  inputs=[dataframe, row_number],
 
27
  "karlo": "https://huggingface.co/kakaobrain/karlo-v1-alpha",
28
  }
29
  SD_1_5_RESULT = """
30
+ "## The traditional one πŸ”₯!
31
  ![img](https://huggingface.co/datasets/OpenGenAI/logos/blob/main/37351293.png)
32
+ \n You mostly resonate with **Stable Diffusion 1-5** released by RunwayML.
33
  \n Stable Diffusion 1-5 is the most used open-source text-to-image model offering an amazing speed-to-image-quality trade-off!
34
+ \n Check out your soulmate [here](https://huggingface.co/runwayml/stable-diffusion-v1-5).
35
  """
36
  SD_2_1_RESULT = """
37
+ ## The creative one 🎨!
38
  ![img](https://huggingface.co/datasets/OpenGenAI/logos/resolve/main/7vmYr2XwVcPtkLzac_jxQ.png)
39
+ \n You mostly resonate with **Stable Diffusion 2-1** released by Stability AI.
40
  \n Stable Diffusion 2-1 is the latest open-source release of Stable Diffusion and allows to render stunning images of much larger sizes than Stable Diffusion v1.
41
  Try it out [here](https://huggingface.co/stabilityai/stable-diffusion-2-1).
42
  """
43
  IF_V1_0 = """
44
+ ## The powerful one ⚑!
45
  ![img](https://huggingface.co/datasets/OpenGenAI/logos/blob/main/1662453741854-63170739dc97a974718be2c7.png)
46
+ \n You mostly resonate with **IF v1-0** released by DeepFloyd.
47
  \n IF v1-0 is by far the largest of the open-sourced text-to-image models and is a very powerful image generator.
48
+ \n Besides being able to generate multiple complex concepts in the same image, IF v1-0 is also extremely good at generating text in images.
49
+ \n Check out your new best friend [here](https://huggingface.co/DeepFloyd/IF-I-XL-v1.0)
50
  """
51
  KARLO = """
52
+ ## The precise one 🎯!
53
  ![img](https://huggingface.co/datasets/OpenGenAI/logos/blob/main/1670220967262-615ed619c807b26d117a49bd.png)
54
+ \n You mostly resonate with **Karlo** released by KakaoBrain.
55
  \n Karlo is based on the same architecture as DALLE-2 and has been trained on the [well curated COYO dataset](https://huggingface.co/datasets/kakaobrain/coyo-700m).
56
+ \n Play around with it [here]("https://huggingface.co/kakaobrain/karlo-v1-alpha").
57
  """
58
 
59
  RESULT = {
 
203
 
204
  dataset.push_to_hub(repo_id, token=os.getenv("HF_TOKEN"))
205
  return {
206
+ intro_view: gr.update(visible=False),
207
  result_view: gr.update(visible=True),
208
  gallery_view: gr.update(visible=False),
209
+ start_view: gr.update(visible=True)
210
  result: RESULT[favorite_model],
211
  }
212
  else:
 
214
  intro_view: gr.update(visible=False),
215
  result_view: gr.update(visible=False),
216
  gallery_view: gr.update(visible=True),
217
+ start_view: gr.update(visible=False)
218
  result: "",
219
  }
220
 
 
222
  TITLE = "# What's Your AI Gen Personality 🧬?"
223
 
224
  DESCRIPTION = """
225
+ *In this interactive game you are shown image descriptions along side 4 AI generated images.
226
+ \n Select the image that best fits the image description.
227
+ \n Answer **10** questions to find out what AI generator most resonates with you.
228
+ \n Your submissions contribute to [**Open Parti Prompts Leaderboard**](https://huggingface.co/spaces/OpenGenAI/parti-prompts-leaderboard) ❀️
229
  """
230
  EXPLANATION = """\n\n
231
  ## What to do πŸ“– \n\n
 
234
  2. A prompt and 4 different images are displayed
235
  3. Select your favorite image
236
  4. After 10 rounds your favorite diffusion model is displayed \n\n
237
+ """
238
+ NOTE = """
239
+ The prompts you are shown originate from the [Parti Prompts](https://huggingface.co/datasets/nateraw/parti-prompts) dataset.
240
  Parti Prompts is designed to test text-to-image AI models on 1600+ prompts of varying difficulty and categories.
241
  The images you are shown have been pre-generated with 4 state-of-the-art open-sourced text-to-image models. \n\n
242
  You answers will be used to contribute to the official [**Open Parti Prompts Leaderboard**](https://huggingface.co/spaces/OpenGenAI/parti-prompts-leaderboard). \n
243
  By playing this game, you are greatly helping the community to have a better, **human-preference-aligned** metric to compare text-to-image models ❀️. \n\n
244
+ Every month, the generated images will be updated with possibly improved models.
245
  """
246
 
247
  GALLERY_COLUMN_NUM = len(SUBMISSIONS)
248
 
249
  with gr.Blocks() as demo:
250
+ gr.Markdown(TITLE)
251
  with gr.Column(visible=True) as intro_view:
 
252
  gr.Markdown(DESCRIPTION)
253
  gr.Markdown(EXPLANATION)
 
254
 
255
  headers = ["prompt", "result", "id", "Challenge", "Category", "Note"] + [
256
  f"choice_{i}" for i in range(len(SUBMISSIONS))
 
279
  )
280
  gr.Markdown("Click on start to play again!")
281
 
282
+ with gr.Column(visible=True) as start_view:
283
+ start_button = gr.Button("Start").style(full_width=True)
284
+ gr.Markdown(NOTE)
285
+
286
  with gr.Column(visible=False):
287
  selected_image = gr.Number(label="Selected index", value=-1, precision=0)
288
 
 
318
  ).then(
319
  fn=change_view,
320
  inputs=[row_number, dataframe],
321
+ outputs=[intro_view, result_view, gallery_view, start_view, result]
322
  ).then(
323
  fn=process, inputs=[dataframe], outputs=[image_1, image_2, image_3, image_4, prompt, counter]
324
  )
 
336
  ).then(
337
  fn=change_view,
338
  inputs=[row_number, dataframe],
339
+ outputs=[intro_view, result_view, gallery_view, start_view, result]
340
  ).then(
341
  fn=process,
342
  inputs=[dataframe, row_number],