tunght commited on
Commit
4306b1a
1 Parent(s): 4f29b72

fix structure following capability. Prioritize structure over copy for structure. Fix new line chracter. Change \n to <br>

Browse files
Files changed (1) hide show
  1. app.py +35 -13
app.py CHANGED
@@ -25,9 +25,24 @@ feature_text = "Brand: Duckly. \nProduct name: Duck runner pro. \nKey properties
25
 
26
  garment_type = "all"
27
 
28
- reference_text = ""
29
-
30
- structure_text = \
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
31
  """# Headline {{ headline | inspiring, bold, action-oriented, max 8 words }}
32
 
33
  ## Introduction
@@ -43,7 +58,7 @@ structure_text = \
43
  {{ technical_specs | informative, to the point, concise list format }}
44
  """
45
 
46
- structure_text_1 = """[type: UK website, style=true, language=English]
47
  {{ introduction_paragraph | motivational, passionate, 1-2 sentences }}
48
  {% for feature in features as bulleted list %}
49
  {{ feature.description | dynamic, direct, 3-6 words }}
@@ -322,7 +337,7 @@ def generate(*data):
322
  # print(term)
323
 
324
  batch = []
325
- min_length = 50
326
  max_length = 150
327
  for i in range(visible + 1):
328
  structure = struct_ref[2 * i]
@@ -340,15 +355,18 @@ Make sure that the structure of each output follows the reference structure.
340
  Make sure to use the tone of voice, rythm, cadence and style of the reference copy for each output.
341
  Use markdown format for each output.
342
  Do not include any part of the reference structure in the output.
 
 
343
  Do not use any of the excluded words in the output.
344
  Include all included words in the output.
345
  Do not hallucinate any information.
346
  Use creative language in each output, do not use the common ways of starting product descriptions.
347
  Avoid common phrases and cliches such as "Step into something", "Elevate something", "Discover something", "Unleash something", "Embrace something", and similar phrases.
348
  For each version, try to write in different style.
 
349
  Rate the quality of each version based on the following criteria:
350
- - how well it follows the tone of voice, rythm, cadence and style of the reference copy.
351
  - how well it follows the reference structure.
 
352
  - how faithful it describes the product features.
353
  - how well it avoid the excluded words.
354
  - how well it includes the included words.
@@ -402,13 +420,14 @@ For each version, write at least {min_length} words and at most {max_length} wor
402
  Make sure that the structure of each output follows the structure of the reference copy.
403
  Make sure to use the tone of voice, rythm, cadence and style of the reference copy for each output.
404
  Use markdown format for each output.
405
- Do not include any part of the reference structure in the output.
406
  Do not use any of the excluded words in the output.
407
  Include all included words in the output.
408
  Do not hallucinate any information.
409
  Use creative language in each output, do not use the common ways of starting product descriptions.
410
  Avoid common phrases and cliches such as "Step into something", "Elevate something", "Discover something", "Unleash something", "Embrace something", and similar phrases.
411
  For each version, try to write in different style.
 
412
  Rate the quality of each version based on the following criteria:
413
  - how well it follows the tone of voice, rythm, cadence and style of the reference copy.
414
  - how faithful it describes the product features.
@@ -464,12 +483,14 @@ For each version, write at least {min_length} words and at most {max_length} wor
464
  Make sure that the structure of each output follows the reference structure.
465
  Use markdown format for each output.
466
  Do not include any part of the reference structure in the output.
 
467
  Do not use any of the excluded words in the output.
468
  Include all included words in the output.
469
  Do not hallucinate any information.
470
  Use creative language in each output, do not use the common ways of starting product descriptions.
471
  Avoid common phrases and cliches such as "Step into something", "Elevate something", "Discover something", "Unleash something", "Embrace something", and similar phrases.
472
  For each version, try to write in different style.
 
473
  Rate the quality of each version based on the following criteria:
474
  - how well it follows the reference structure.
475
  - how faithful it describes the product features.
@@ -594,10 +615,10 @@ def remove_output_click(*struct_ref):
594
  return struct_ref
595
 
596
 
597
- def show_advanced(model, temperature):
598
- model = gr.Dropdown(models, value="gpt-4-turbo", interactive=True, label="Model", visible=True)
599
- temperature = gr.Slider(minimum=0., maximum=1.0, value=0., interactive=True, label="Temperature", visible=True)
600
- return model, temperature
601
 
602
 
603
  with gr.Blocks() as demo:
@@ -610,7 +631,7 @@ with gr.Blocks() as demo:
610
  garment_type = gr.Textbox(label="Garment Type", value="all", lines=1, interactive=True)
611
  # language = gr.Dropdown(languages, value="American English", interactive=True, label="Language")
612
  with gr.Accordion(label="Advanced Options", open=False):
613
- model = gr.Dropdown(models, value="gpt-4-turbo", interactive=True, label="Model", visible=True)
614
  temperature = gr.Slider(minimum=0., maximum=1.0, value=0., interactive=True, label="Temperature", visible=True)
615
  nversions = gr.Slider(minimum=1, maximum=10, value=1, step=int, interactive=True, label="Number of versions", visible=True)
616
  excluded_words = gr.Textbox(label="Excluded words", interactive=True, lines=2)
@@ -627,7 +648,8 @@ with gr.Blocks() as demo:
627
  struct_ref = [val for i in range(10) for val in
628
  [gr.Textbox(label=f"Structure {i}", lines=10, value="", interactive=True, visible=i <= visible),
629
  gr.Textbox(label=f"Reference copy {i}", lines=3, value="", interactive=True, visible=i <= visible)]]
630
- struct_ref[0].value = structure_text_1
 
631
  # struct_ref[2].value = structure_text_2
632
  with gr.Row():
633
  add_output = gr.Button(value="Add Output")
 
25
 
26
  garment_type = "all"
27
 
28
+ reference_text = """NULLUS STUDIOS
29
+ Black Camellia Lapel Brooch Coat
30
+ Brushed wool-blend melton coat.
31
+
32
+ 路 Detachable brooch at notched lapel
33
+ 路 Button closure
34
+ 路 Welt pocket and flap pockets
35
+ 路 Padded shoulders
36
+ 路 Four-button surgeon's cuffs
37
+ 路 TextPatch at cuff
38
+ 路 Logo cutout at back collar
39
+ 路 Welt pockets at interior
40
+ 路 Full cupro satin lining
41
+ 路 Logo-engraved antiqued silver-tone hardware"""
42
+
43
+ # structure_text = ""
44
+
45
+ structure_text_0 = \
46
  """# Headline {{ headline | inspiring, bold, action-oriented, max 8 words }}
47
 
48
  ## Introduction
 
58
  {{ technical_specs | informative, to the point, concise list format }}
59
  """
60
 
61
+ structure_text = """[type: UK website, style=true, language=English]
62
  {{ introduction_paragraph | motivational, passionate, 1-2 sentences }}
63
  {% for feature in features as bulleted list %}
64
  {{ feature.description | dynamic, direct, 3-6 words }}
 
337
  # print(term)
338
 
339
  batch = []
340
+ min_length = 0
341
  max_length = 150
342
  for i in range(visible + 1):
343
  structure = struct_ref[2 * i]
 
355
  Make sure to use the tone of voice, rythm, cadence and style of the reference copy for each output.
356
  Use markdown format for each output.
357
  Do not include any part of the reference structure in the output.
358
+ The structure of the output should follow the reference structure.
359
+ Do not use the structure of the reference copy in the output.
360
  Do not use any of the excluded words in the output.
361
  Include all included words in the output.
362
  Do not hallucinate any information.
363
  Use creative language in each output, do not use the common ways of starting product descriptions.
364
  Avoid common phrases and cliches such as "Step into something", "Elevate something", "Discover something", "Unleash something", "Embrace something", and similar phrases.
365
  For each version, try to write in different style.
366
+ Put each item in the list on a separate line. Use <br> tag for line breaks.
367
  Rate the quality of each version based on the following criteria:
 
368
  - how well it follows the reference structure.
369
+ - how well it follows the tone of voice, rythm, cadence and style of the reference copy.
370
  - how faithful it describes the product features.
371
  - how well it avoid the excluded words.
372
  - how well it includes the included words.
 
420
  Make sure that the structure of each output follows the structure of the reference copy.
421
  Make sure to use the tone of voice, rythm, cadence and style of the reference copy for each output.
422
  Use markdown format for each output.
423
+ Make sure that the structure of each output follows the structure of the reference copy.
424
  Do not use any of the excluded words in the output.
425
  Include all included words in the output.
426
  Do not hallucinate any information.
427
  Use creative language in each output, do not use the common ways of starting product descriptions.
428
  Avoid common phrases and cliches such as "Step into something", "Elevate something", "Discover something", "Unleash something", "Embrace something", and similar phrases.
429
  For each version, try to write in different style.
430
+ Put each item in the list on a separate line. Use <br> tag for line breaks.
431
  Rate the quality of each version based on the following criteria:
432
  - how well it follows the tone of voice, rythm, cadence and style of the reference copy.
433
  - how faithful it describes the product features.
 
483
  Make sure that the structure of each output follows the reference structure.
484
  Use markdown format for each output.
485
  Do not include any part of the reference structure in the output.
486
+ Make sure that the structure of each output follows the reference structure.
487
  Do not use any of the excluded words in the output.
488
  Include all included words in the output.
489
  Do not hallucinate any information.
490
  Use creative language in each output, do not use the common ways of starting product descriptions.
491
  Avoid common phrases and cliches such as "Step into something", "Elevate something", "Discover something", "Unleash something", "Embrace something", and similar phrases.
492
  For each version, try to write in different style.
493
+ Put each item in the list on a separate line. Use <br> tag for line breaks.
494
  Rate the quality of each version based on the following criteria:
495
  - how well it follows the reference structure.
496
  - how faithful it describes the product features.
 
615
  return struct_ref
616
 
617
 
618
+ # def show_advanced(model, temperature):
619
+ # model = gr.Dropdown(models, value="gpt-4-turbo", interactive=True, label="Model", visible=True)
620
+ # temperature = gr.Slider(minimum=0., maximum=1.0, value=0., interactive=True, label="Temperature", visible=True)
621
+ # return model, temperature
622
 
623
 
624
  with gr.Blocks() as demo:
 
631
  garment_type = gr.Textbox(label="Garment Type", value="all", lines=1, interactive=True)
632
  # language = gr.Dropdown(languages, value="American English", interactive=True, label="Language")
633
  with gr.Accordion(label="Advanced Options", open=False):
634
+ model = gr.Dropdown(models, value="claude-3-5-sonnet-20240620", interactive=True, label="Model", visible=True)
635
  temperature = gr.Slider(minimum=0., maximum=1.0, value=0., interactive=True, label="Temperature", visible=True)
636
  nversions = gr.Slider(minimum=1, maximum=10, value=1, step=int, interactive=True, label="Number of versions", visible=True)
637
  excluded_words = gr.Textbox(label="Excluded words", interactive=True, lines=2)
 
648
  struct_ref = [val for i in range(10) for val in
649
  [gr.Textbox(label=f"Structure {i}", lines=10, value="", interactive=True, visible=i <= visible),
650
  gr.Textbox(label=f"Reference copy {i}", lines=3, value="", interactive=True, visible=i <= visible)]]
651
+ struct_ref[0].value = structure_text
652
+ struct_ref[1].value = reference_text
653
  # struct_ref[2].value = structure_text_2
654
  with gr.Row():
655
  add_output = gr.Button(value="Add Output")