m3hrdadfi commited on
Commit
025b08b
1 Parent(s): 37e608c

Upgrade the UI-UX

Browse files
app.py CHANGED
@@ -10,7 +10,11 @@ from PIL import (
10
  ImageDraw
11
  )
12
 
 
 
 
13
  import re
 
14
  import textwrap
15
  from examples import EXAMPLES
16
  import meta
@@ -21,6 +25,8 @@ from utils import (
21
  pure_comma_separation
22
  )
23
 
 
 
24
 
25
  class TextGeneration:
26
  def __init__(self):
@@ -39,8 +45,8 @@ class TextGeneration:
39
  ],
40
  'ingredients': [
41
  '1 potato',
42
- '1 slice cheese',
43
- '1 potato',
44
  '1 slice cheese'
45
  '1 potato',
46
  '1 slice cheese',
@@ -56,11 +62,16 @@ class TextGeneration:
56
  self.generator = None
57
  self.task = "text2text-generation"
58
  self.model_name_or_path = "flax-community/t5-recipe-generation"
 
 
 
 
 
 
 
 
59
  self.list_division = 5
60
  self.point = "-"
61
- self.h1_font = ImageFont.truetype("asset/fonts/PT_Serif/PTSerif-Bold.ttf", 75)
62
- self.h2_font = ImageFont.truetype("asset/fonts/PT_Serif/PTSerif-Bold.ttf", 50)
63
- self.p_font = ImageFont.truetype("asset/fonts/PT_Serif/PTSerif-Regular.ttf", 30)
64
  set_seed(42)
65
 
66
  def _skip_special_tokens_and_prettify(self, text):
@@ -96,59 +107,67 @@ class TextGeneration:
96
 
97
  def prepare_frame(self, recipe, frame):
98
  im_editable = ImageDraw.Draw(frame)
 
 
 
 
 
 
 
 
 
 
 
 
 
99
  # Title
100
- ws, hs = 120, 500
101
  im_editable.text(
102
- (ws, hs),
103
- textwrap.fill(recipe["title"], 25),
104
  (61, 61, 70),
105
- font=self.h1_font,
106
  )
107
  # Ingredients
108
- hs = hs + 270
109
  im_editable.text(
110
- (ws, hs),
111
  "Ingredients",
112
  (61, 61, 70),
113
- font=self.h2_font,
114
  )
115
- hs = hs + 80
116
  ingredients = recipe["ingredients"]
117
- ingredients_col1 = [textwrap.fill(item, 30) for item in ingredients[:self.list_division]]
118
- ingredients_col2 = [textwrap.fill(item, 30) for item in ingredients[self.list_division:]]
119
 
120
  im_editable.text(
121
- (ws + 10, hs),
122
- "\n".join([f"- {item}" for item in ingredients_col1]),
123
  (61, 61, 70),
124
- font=self.p_font,
125
  )
 
126
  im_editable.text(
127
- (ws + 500, hs),
128
- "\n".join([f"{self.point} {item}" for item in ingredients_col2]),
129
  (61, 61, 70),
130
- font=self.p_font,
131
  )
132
- # Directions
133
- hs = hs + 240
 
134
  im_editable.text(
135
- (ws, hs),
136
- "Directions",
137
  (61, 61, 70),
138
- font=self.h2_font,
139
  )
140
- hs = hs + 80
141
- directions = [textwrap.fill(item, 70).replace("\n", "\n ") for item in recipe["directions"]]
142
  im_editable.text(
143
- (ws + 10, hs),
144
- "\n".join([f"{self.point} {item}" for item in directions]),
145
  (61, 61, 70),
146
- font=self.p_font,
147
  )
148
  return frame
149
 
150
  def generate(self, items, generation_kwargs):
151
- print(generation_kwargs)
152
  if not self.debug:
153
  generation_kwargs["num_return_sequences"] = 1
154
  # generation_kwargs["return_full_text"] = False
@@ -165,8 +184,8 @@ class TextGeneration:
165
 
166
  return self.dummy_output
167
 
168
- def generate_frame(self, recipe):
169
- frame = load_image("asset/images/recipe-post.png")
170
  return self.prepare_frame(recipe, frame)
171
 
172
 
@@ -205,54 +224,87 @@ def main():
205
  initial_sidebar_state="expanded"
206
  )
207
  generator = load_text_generator()
 
 
 
208
  local_css("asset/css/style.css")
209
 
210
- st.sidebar.image(load_image("asset/images/chef-transformer-transparent.png"), width=310)
211
- st.sidebar.title("Welcome to our lovely restaurant, what can I do for you?")
212
- chef = st.sidebar.selectbox("Choose your chef", index=0, options=["Chef Scheherazade", "Chef Giovanni"])
213
- is_text = st.sidebar.selectbox(
214
- label='Recipe',
215
- options=(True, False),
216
- help="Will generate your recipe as a text post",
217
- )
218
- is_frame = st.sidebar.selectbox(
219
- label='Recipe for Instagram?',
220
- options=(True, False),
221
- help="Will generate your recipe as an Instagram post",
222
- )
223
 
224
- st.markdown(meta.HEADER_INFO)
225
- prompts = list(EXAMPLES.keys()) + ["Custom"]
226
- prompt = st.selectbox('Examples', prompts, index=len(prompts) - 1)
 
 
 
 
227
 
228
- if prompt == "Custom":
229
- prompt_box = ""
230
- else:
231
- prompt_box = EXAMPLES[prompt]
232
 
233
- items = st.text_input(
234
- 'Add custom ingredients here (separated by `,`): ',
235
- pure_comma_separation(prompt_box, return_list=False),
236
- key="custom_keywords",
237
- max_chars=1000)
238
- items = pure_comma_separation(items, return_list=False)
239
- entered_items = st.empty()
240
 
241
- if st.button('Get Recipe!'):
 
 
 
 
 
242
  entered_items.markdown("**Generate recipe for:** " + items)
243
  with st.spinner("Generating recipe..."):
244
 
245
- if isinstance(items, str) and len(items) > 1:
 
 
 
 
 
246
  gen_kw = chef_top if chef == "Chef Scheherazade" else chef_beam
247
  generated_recipe = generator.generate(items, gen_kw)
248
 
249
- if is_text:
250
- title = generated_recipe["title"]
251
- ingredients = generated_recipe["ingredients"]
252
- directions = [textwrap.fill(item, 70).replace("\n", "\n ") for item in
253
- generated_recipe["directions"]]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
254
  st.markdown(
255
  " ".join([
 
256
  f"<h2>{title}</h2>",
257
  "<h3>Ingredient</h3>",
258
  "<ul class='ingredients-list'>",
@@ -262,31 +314,11 @@ def main():
262
  "<ul class='ingredients-list'>",
263
  " ".join([f'<li>{item}</li>' for item in directions]),
264
  "</ul>",
 
265
  ]),
266
  unsafe_allow_html=True
267
  )
268
 
269
- if is_frame:
270
- recipe_post = generator.generate_frame(generated_recipe)
271
-
272
- col1, col2, col3 = st.beta_columns([1, 6, 1])
273
- with col1:
274
- st.write("")
275
-
276
- with col2:
277
- st.image(
278
- recipe_post,
279
- # width=500,
280
- caption="Your recipe",
281
- use_column_width="auto",
282
- output_format="PNG"
283
- )
284
-
285
- with col3:
286
- st.write("")
287
- else:
288
- entered_items.markdown("Enter your items...")
289
-
290
 
291
  if __name__ == '__main__':
292
  main()
 
10
  ImageDraw
11
  )
12
 
13
+ import numpy as np
14
+ from datetime import datetime
15
+ import glob
16
  import re
17
+ import random
18
  import textwrap
19
  from examples import EXAMPLES
20
  import meta
 
25
  pure_comma_separation
26
  )
27
 
28
+ np.random.seed(42)
29
+
30
 
31
  class TextGeneration:
32
  def __init__(self):
 
45
  ],
46
  'ingredients': [
47
  '1 potato',
48
+ '1 slice cheese 1 slice cheese',
49
+ '1 potato 1 slice cheese 1 slice cheese',
50
  '1 slice cheese'
51
  '1 potato',
52
  '1 slice cheese',
 
62
  self.generator = None
63
  self.task = "text2text-generation"
64
  self.model_name_or_path = "flax-community/t5-recipe-generation"
65
+ self.frames = list(glob.glob("asset/images/frames/*.jpg"))
66
+ self.fonts = {
67
+ "title": ImageFont.truetype("asset/fonts/Poppins-Bold.ttf", 90),
68
+ "sub_title": ImageFont.truetype("asset/fonts/Poppins-Medium.ttf", 30),
69
+ "body_bold": ImageFont.truetype("asset/fonts/Montserrat-Bold.ttf", 50),
70
+ "body": ImageFont.truetype("asset/fonts/Montserrat-Regular.ttf", 30),
71
+
72
+ }
73
  self.list_division = 5
74
  self.point = "-"
 
 
 
75
  set_seed(42)
76
 
77
  def _skip_special_tokens_and_prettify(self, text):
 
107
 
108
  def prepare_frame(self, recipe, frame):
109
  im_editable = ImageDraw.Draw(frame)
110
+ # Info
111
+ im_editable.text(
112
+ (1570, 180),
113
+ datetime.now().strftime("%Y-%m-%d %H:%M"),
114
+ (61, 61, 70),
115
+ font=self.fonts["sub_title"],
116
+ )
117
+ im_editable.text(
118
+ (1570, 170 + 70),
119
+ "By " + recipe["by"],
120
+ (61, 61, 70),
121
+ font=self.fonts["sub_title"],
122
+ )
123
  # Title
 
124
  im_editable.text(
125
+ (400, 650),
126
+ textwrap.fill(recipe["title"], 30),
127
  (61, 61, 70),
128
+ font=self.fonts["title"],
129
  )
130
  # Ingredients
 
131
  im_editable.text(
132
+ (100, 1050),
133
  "Ingredients",
134
  (61, 61, 70),
135
+ font=self.fonts["body_bold"],
136
  )
 
137
  ingredients = recipe["ingredients"]
138
+ ingredients = [textwrap.fill(item, 30).replace("\n", "\n ") for item in ingredients]
 
139
 
140
  im_editable.text(
141
+ (100, 1130),
142
+ "\n".join([f"{self.point} {item}" for item in ingredients]),
143
  (61, 61, 70),
144
+ font=self.fonts["body"],
145
  )
146
+ # Directions
147
  im_editable.text(
148
+ (700, 1050),
149
+ "Directions",
150
  (61, 61, 70),
151
+ font=self.fonts["body_bold"],
152
  )
153
+ directions = recipe["directions"]
154
+ directions_col1 = [textwrap.fill(item, 30).replace("\n", "\n ") for item in directions[:self.list_division]]
155
+ directions_col2 = [textwrap.fill(item, 30).replace("\n", "\n ") for item in directions[self.list_division:]]
156
  im_editable.text(
157
+ (700, 1130),
158
+ "\n".join([f"{i + 1}. {item}" for i, item in enumerate(directions_col1)]).strip(),
159
  (61, 61, 70),
160
+ font=self.fonts["body"],
161
  )
 
 
162
  im_editable.text(
163
+ (1300, 1130),
164
+ "\n".join([f"{i + 1 + self.list_division}. {item}" for i, item in enumerate(directions_col2)]).strip(),
165
  (61, 61, 70),
166
+ font=self.fonts["body"],
167
  )
168
  return frame
169
 
170
  def generate(self, items, generation_kwargs):
 
171
  if not self.debug:
172
  generation_kwargs["num_return_sequences"] = 1
173
  # generation_kwargs["return_full_text"] = False
 
184
 
185
  return self.dummy_output
186
 
187
+ def generate_frame(self, recipe, frame_path):
188
+ frame = load_image(frame_path)
189
  return self.prepare_frame(recipe, frame)
190
 
191
 
 
224
  initial_sidebar_state="expanded"
225
  )
226
  generator = load_text_generator()
227
+ if 'get_random_frame' not in st.session_state:
228
+ st.session_state.get_random_frame = generator.frames[0]
229
+
230
  local_css("asset/css/style.css")
231
 
232
+ col1, col2 = st.beta_columns([5, 3])
233
+ with col2:
234
+ st.image(load_image("asset/images/chef-transformer-transparent.png"), width=300)
235
+ st.markdown(meta.SIDEBAR_INFO, unsafe_allow_html=True)
236
+
237
+ with st.beta_expander("Where did this story start?"):
238
+ st.markdown(meta.STORY, unsafe_allow_html=True)
239
+
240
+ with col1:
241
+ st.markdown(meta.HEADER_INFO, unsafe_allow_html=True)
242
+
243
+ st.markdown(meta.CHEF_INFO, unsafe_allow_html=True)
244
+ chef = st.selectbox("Choose your chef", index=0, options=["Chef Scheherazade", "Chef Giovanni"])
245
 
246
+ prompts = list(EXAMPLES.keys()) + ["Custom"]
247
+ prompt = st.selectbox(
248
+ 'Examples (select from this list)',
249
+ prompts,
250
+ # index=len(prompts) - 1,
251
+ index=0
252
+ )
253
 
254
+ if prompt == "Custom":
255
+ prompt_box = ""
256
+ else:
257
+ prompt_box = EXAMPLES[prompt]
258
 
259
+ items = st.text_area(
260
+ 'Insert your ingredients here (separated by `,`): ',
261
+ pure_comma_separation(prompt_box, return_list=False),
262
+ )
263
+ items = pure_comma_separation(items, return_list=False)
264
+ entered_items = st.empty()
265
+ recipe_button = st.button('Get Recipe!')
266
 
267
+ st.markdown(
268
+ "<hr />",
269
+ unsafe_allow_html=True
270
+ )
271
+ if recipe_button:
272
+ st.session_state.get_random_frame = generator.frames[random.randint(0, len(generator.frames)) - 1]
273
  entered_items.markdown("**Generate recipe for:** " + items)
274
  with st.spinner("Generating recipe..."):
275
 
276
+ if not isinstance(items, str) or not len(items) > 1:
277
+ entered_items.markdown(
278
+ f"**{chef}** would like to know what ingredients do you like to use in "
279
+ f"your food? "
280
+ )
281
+ else:
282
  gen_kw = chef_top if chef == "Chef Scheherazade" else chef_beam
283
  generated_recipe = generator.generate(items, gen_kw)
284
 
285
+ title = generated_recipe["title"]
286
+ ingredients = generated_recipe["ingredients"]
287
+ directions = [textwrap.fill(item, 70).replace("\n", "\n ") for item in
288
+ generated_recipe["directions"]]
289
+ generated_recipe["by"] = chef
290
+
291
+ r1, r2 = st.beta_columns([3, 5])
292
+
293
+ with r1:
294
+ # st.write(st.session_state.get_random_frame)
295
+ recipe_post = generator.generate_frame(generated_recipe, st.session_state.get_random_frame)
296
+ st.image(
297
+ recipe_post,
298
+ # width=500,
299
+ caption="Click 🔎 to enlarge",
300
+ use_column_width="auto",
301
+ output_format="PNG"
302
+ )
303
+
304
+ with r2:
305
  st.markdown(
306
  " ".join([
307
+ "<div class='r-text-recipe'>",
308
  f"<h2>{title}</h2>",
309
  "<h3>Ingredient</h3>",
310
  "<ul class='ingredients-list'>",
 
314
  "<ul class='ingredients-list'>",
315
  " ".join([f'<li>{item}</li>' for item in directions]),
316
  "</ul>",
317
+ "</div>"
318
  ]),
319
  unsafe_allow_html=True
320
  )
321
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
322
 
323
  if __name__ == '__main__':
324
  main()
asset/css/style.css CHANGED
@@ -1,14 +1,51 @@
1
  body {
2
- background-color: #eee;
3
  }
4
 
 
5
  .fullScreenFrame > div {
6
  display: flex;
7
  justify-content: center;
8
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9
 
 
 
 
 
 
 
 
 
 
10
  .ingredients-list {
11
  columns: 2;
12
  -webkit-columns: 2;
13
  -moz-columns: 2;
14
- }
 
1
  body {
2
+ background-color: #fff;
3
  }
4
 
5
+
6
  .fullScreenFrame > div {
7
  display: flex;
8
  justify-content: center;
9
  }
10
+ .comma:not(:empty) ~ .comma:not(:empty):before {
11
+ content: " , ";
12
+ }
13
+ .strong {
14
+ font-weight: bold;
15
+ }
16
+ .d-block {
17
+ display: block;
18
+ }
19
+ .extra-info {
20
+ font-weight: normal;
21
+ font-style: italic;
22
+ font-size: small;
23
+ }
24
+
25
+ .contributors {
26
+ margin-bottom: 10px;
27
+ border-bottom: 1px solid #f3f3f3;
28
+ padding-bottom: 10px;
29
+ }
30
+ .contributors a.contributor {
31
+ text-decoration: none;
32
+ color: #9b9dad;
33
+ }
34
+ .contributors a.contributor:hover {
35
+ text-decoration: underline;
36
+ }
37
 
38
+ .r-text-recipe {
39
+ padding-left: 30px;
40
+ margin-left: 10px;
41
+ border-left: 1px dashed #eee;
42
+ }
43
+ .r-text-recipe > h2 {
44
+ margin-top: 0;
45
+ padding-top: 0;
46
+ }
47
  .ingredients-list {
48
  columns: 2;
49
  -webkit-columns: 2;
50
  -moz-columns: 2;
51
+ }
asset/fonts/Montserrat-Bold.ttf ADDED
Binary file (244 kB). View file
 
asset/fonts/Montserrat-Regular.ttf ADDED
Binary file (246 kB). View file
 
asset/fonts/PT_Serif/OFL.txt DELETED
@@ -1,94 +0,0 @@
1
- Copyright (c) 2010, ParaType Ltd. (http://www.paratype.com/public),
2
- with Reserved Font Names "PT Sans", "PT Serif" and "ParaType".
3
-
4
- This Font Software is licensed under the SIL Open Font License, Version 1.1.
5
- This license is copied below, and is also available with a FAQ at:
6
- http://scripts.sil.org/OFL
7
-
8
-
9
- -----------------------------------------------------------
10
- SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
11
- -----------------------------------------------------------
12
-
13
- PREAMBLE
14
- The goals of the Open Font License (OFL) are to stimulate worldwide
15
- development of collaborative font projects, to support the font creation
16
- efforts of academic and linguistic communities, and to provide a free and
17
- open framework in which fonts may be shared and improved in partnership
18
- with others.
19
-
20
- The OFL allows the licensed fonts to be used, studied, modified and
21
- redistributed freely as long as they are not sold by themselves. The
22
- fonts, including any derivative works, can be bundled, embedded,
23
- redistributed and/or sold with any software provided that any reserved
24
- names are not used by derivative works. The fonts and derivatives,
25
- however, cannot be released under any other type of license. The
26
- requirement for fonts to remain under this license does not apply
27
- to any document created using the fonts or their derivatives.
28
-
29
- DEFINITIONS
30
- "Font Software" refers to the set of files released by the Copyright
31
- Holder(s) under this license and clearly marked as such. This may
32
- include source files, build scripts and documentation.
33
-
34
- "Reserved Font Name" refers to any names specified as such after the
35
- copyright statement(s).
36
-
37
- "Original Version" refers to the collection of Font Software components as
38
- distributed by the Copyright Holder(s).
39
-
40
- "Modified Version" refers to any derivative made by adding to, deleting,
41
- or substituting -- in part or in whole -- any of the components of the
42
- Original Version, by changing formats or by porting the Font Software to a
43
- new environment.
44
-
45
- "Author" refers to any designer, engineer, programmer, technical
46
- writer or other person who contributed to the Font Software.
47
-
48
- PERMISSION & CONDITIONS
49
- Permission is hereby granted, free of charge, to any person obtaining
50
- a copy of the Font Software, to use, study, copy, merge, embed, modify,
51
- redistribute, and sell modified and unmodified copies of the Font
52
- Software, subject to the following conditions:
53
-
54
- 1) Neither the Font Software nor any of its individual components,
55
- in Original or Modified Versions, may be sold by itself.
56
-
57
- 2) Original or Modified Versions of the Font Software may be bundled,
58
- redistributed and/or sold with any software, provided that each copy
59
- contains the above copyright notice and this license. These can be
60
- included either as stand-alone text files, human-readable headers or
61
- in the appropriate machine-readable metadata fields within text or
62
- binary files as long as those fields can be easily viewed by the user.
63
-
64
- 3) No Modified Version of the Font Software may use the Reserved Font
65
- Name(s) unless explicit written permission is granted by the corresponding
66
- Copyright Holder. This restriction only applies to the primary font name as
67
- presented to the users.
68
-
69
- 4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
70
- Software shall not be used to promote, endorse or advertise any
71
- Modified Version, except to acknowledge the contribution(s) of the
72
- Copyright Holder(s) and the Author(s) or with their explicit written
73
- permission.
74
-
75
- 5) The Font Software, modified or unmodified, in part or in whole,
76
- must be distributed entirely under this license, and must not be
77
- distributed under any other license. The requirement for fonts to
78
- remain under this license does not apply to any document created
79
- using the Font Software.
80
-
81
- TERMINATION
82
- This license becomes null and void if any of the above conditions are
83
- not met.
84
-
85
- DISCLAIMER
86
- THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
87
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
88
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
89
- OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
90
- COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
91
- INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
92
- DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
93
- FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
94
- OTHER DEALINGS IN THE FONT SOFTWARE.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
asset/fonts/PT_Serif/PTSerif-Bold.ttf DELETED
Binary file (196 kB)
 
asset/fonts/PT_Serif/PTSerif-BoldItalic.ttf DELETED
Binary file (193 kB)
 
asset/fonts/PT_Serif/PTSerif-Italic.ttf DELETED
Binary file (232 kB)
 
asset/fonts/PT_Serif/PTSerif-Regular.ttf DELETED
Binary file (215 kB)
 
asset/fonts/Poppins-Bold.ttf ADDED
Binary file (154 kB). View file
 
asset/fonts/Poppins-Medium.ttf ADDED
Binary file (156 kB). View file
 
asset/images/frames/1.jpg ADDED
asset/images/frames/10.jpg ADDED
asset/images/frames/2.jpg ADDED
asset/images/frames/3.jpg ADDED
asset/images/frames/4.jpg ADDED
asset/images/frames/5.jpg ADDED
asset/images/frames/6.jpg ADDED
asset/images/frames/7.jpg ADDED
asset/images/frames/8.jpg ADDED
asset/images/frames/9.jpg ADDED
meta.py CHANGED
@@ -1,10 +1,41 @@
1
- HEADER_INFO = """
2
- # Chef Transformer 🍲
3
-
4
- This demo uses [T5 trained on RecipeNLG](https://huggingface.co/flax-community/t5-recipe-generation)
5
- to generate recipe from a given set of ingredients
6
- """.strip()
7
  SIDEBAR_INFO = """
8
- # Configuration
 
 
 
 
 
 
 
 
 
 
 
9
  """.strip()
10
  PROMPT_BOX = "Add custom ingredients here (separated by `,`): "
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ HEADER_INFO = """""".strip()
 
 
 
 
 
2
  SIDEBAR_INFO = """
3
+ <div class="contributors">
4
+ <a class="contributor comma" href="https://huggingface.co/m3hrdadfi">Mehrdad Farahani</a>
5
+ <a class="contributor comma" href="https://huggingface.co/dk-crazydiv">Kartik Godawat</a>
6
+ <a class="contributor comma" href="https://huggingface.co/hassiahk">Haswanth Aekula</a>
7
+ <a class="contributor comma" href="https://huggingface.co/rays2pix">Deepak Pandian</a>
8
+ <a class="contributor comma" href="https://huggingface.co/nbroad">Nicholas Broad</a>
9
+ </div>
10
+ """
11
+ CHEF_INFO = """
12
+ <p class="strong">Welcome to our lovely restaurant!
13
+ <span class="d-block extra-info">(We are at your service with two of our best chefs in the world, Chef Scheherazade,
14
+ Chef Giovanni.)</span></p>
15
  """.strip()
16
  PROMPT_BOX = "Add custom ingredients here (separated by `,`): "
17
+ STORY = """
18
+ Hello everyone, I am **Chef Transformer**, the owner of this restaurant and headmaster of two other chefs **Scheherazade**, and **Giovanni**.
19
+ In fact, to be more precise, I was made by a group of [NLP Engineers](
20
+ https://huggingface.co/flax-community/t5-recipe-generation#team-members) so that to get your raw
21
+ materials and with the help of my other associates (Scheherazade, and Giovanni) which participated in [T5 fine-tuning program (chef program)](https://huggingface.co/flax-community/t5-recipe-generation) be able to prepare food recipes for you.
22
+ Before going any further, highly important to mention both cooks are capable, except that Scheherazade is *creative*
23
+ while Giovanni is *meticulous*.
24
+
25
+ At first, it was hard, and we had to read cookbooks to learn, whereas the books somehow consist of trivial recipes, but engineers helped us focus on essential parts of recipes for specific food items.
26
+ Also, they taught us to consider the food items (known as NER), ingredients, directions, and, more importantly, food names and then map them in the following form in our skills and histories.
27
+
28
+ ```text
29
+ [Input]
30
+ {NER: separated by comma}
31
+
32
+ [Targets]
33
+ title: {TITLE} <section>
34
+ ingredients: {INGREDIENTS: separated by <sep>} <section>
35
+ directions: {DIRECTIONS: separated by <sep>}.
36
+ ```
37
+
38
+ It was a challenging week, but we learned a lot, to be honest. Finally, we graduated with [high scores](
39
+ https://huggingface.co/flax-community/t5-recipe-generation#evaluation) in our
40
+ classroom and established this restaurant. Do not forget to introduce us to others.
41
+ """.strip()