Spaces:
Runtime error
Runtime error
fix story, minor grammar
Browse files- app.py +3 -3
- asset/css/style.css +1 -1
- meta.py +13 -22
app.py
CHANGED
@@ -80,7 +80,7 @@ class TextGeneration:
|
|
80 |
|
81 |
}
|
82 |
self.list_division = 5
|
83 |
-
self.point = "
|
84 |
set_seed(42)
|
85 |
|
86 |
def _skip_special_tokens_and_prettify(self, text):
|
@@ -333,11 +333,11 @@ def main():
|
|
333 |
" ".join([
|
334 |
"<div class='r-text-recipe'>",
|
335 |
f"<h2>{title}</h2>",
|
336 |
-
"<h3>
|
337 |
"<ul class='ingredients-list'>",
|
338 |
" ".join([f'<li>{item}</li>' for item in ingredients]),
|
339 |
"</ul>",
|
340 |
-
"<h3>
|
341 |
"<ol class='ingredients-list'>",
|
342 |
" ".join([f'<li>{item}</li>' for item in directions]),
|
343 |
"</ol>",
|
|
|
80 |
|
81 |
}
|
82 |
self.list_division = 5
|
83 |
+
self.point = "β’"
|
84 |
set_seed(42)
|
85 |
|
86 |
def _skip_special_tokens_and_prettify(self, text):
|
|
|
333 |
" ".join([
|
334 |
"<div class='r-text-recipe'>",
|
335 |
f"<h2>{title}</h2>",
|
336 |
+
"<h3>Ingredients</h3>",
|
337 |
"<ul class='ingredients-list'>",
|
338 |
" ".join([f'<li>{item}</li>' for item in ingredients]),
|
339 |
"</ul>",
|
340 |
+
"<h3>Directions</h3>",
|
341 |
"<ol class='ingredients-list'>",
|
342 |
" ".join([f'<li>{item}</li>' for item in directions]),
|
343 |
"</ol>",
|
asset/css/style.css
CHANGED
@@ -8,7 +8,7 @@ body {
|
|
8 |
justify-content: center;
|
9 |
}
|
10 |
.comma:not(:empty) ~ .comma:not(:empty):before {
|
11 |
-
content: "
|
12 |
}
|
13 |
.strong {
|
14 |
font-weight: bold;
|
|
|
8 |
justify-content: center;
|
9 |
}
|
10 |
.comma:not(:empty) ~ .comma:not(:empty):before {
|
11 |
+
content: ", ";
|
12 |
}
|
13 |
.strong {
|
14 |
font-weight: bold;
|
meta.py
CHANGED
@@ -10,36 +10,27 @@ SIDEBAR_INFO = """
|
|
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
|
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**,
|
19 |
-
**Scheherazade
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
program)](https://huggingface.co/flax-community/t5-recipe-generation) hosted by [Huggingface / Flax community](https://huggingface.co/flax-community).
|
24 |
-
Before going any further, highly important to mention both cooks are capable, except that Scheherazade is **creative** while Giovanni is **meticulous**,
|
25 |
-
and I forgot to say that I have a remarkable ability to **communicate with the customer**.
|
26 |
-
|
27 |
-
At first, it was complicated and challenging, and we had to read cookbooks to learn, whereas the books somehow consist of trivial recipes. However, engineers
|
28 |
-
helped us focus on essential parts of recipes for specific food items. Also, they taught us to consider the
|
29 |
-
`food items (known as NER)`, `ingredients`, `directions`, and, more importantly, `food names` and then map them in the following form in our skills and backgrounds.
|
30 |
-
|
31 |
-
|
32 |
```text
|
33 |
[Input]
|
34 |
-
{
|
35 |
|
36 |
[Targets]
|
37 |
title: {TITLE} <section>
|
38 |
ingredients: {INGREDIENTS: separated by <sep>} <section>
|
39 |
directions: {DIRECTIONS: separated by <sep>}.
|
40 |
```
|
41 |
-
|
42 |
-
|
43 |
-
https://huggingface.co/flax-community/t5-recipe-generation#evaluation) in our
|
44 |
-
|
45 |
-
""".strip()
|
|
|
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 the best chefs in the world: Chef Scheherazade,
|
14 |
+
Chef Giovanni. Scheherazade is known for being more creative whereas Giovanni is more meticulous.)</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. I was made by a group of [NLP Engineers](
|
19 |
+
https://huggingface.co/flax-community/t5-recipe-generation#team-members) to train my two prodigy recipe creators: **Chef Scheherazade** and **Chef Giovanni**. Both of my students participated in my rigorous culinary program, [T5 fine-tune training](https://huggingface.co/flax-community/t5-recipe-generation), to learn how to prepare exquisite cuisines from a wide variety of ingredients.
|
20 |
+
I've never been more proud of my students -- both can produce exceptional dishes but I regard Scheherazade as being *creative* while Giovanni is *meticulous*. If you give each of them the same ingredients, they'll usually come up with something different.
|
21 |
+
At the start of the program the chefs read cookbooks containing thousands of recipes of varying difficulties and from cultures all over the world. The NLP engineers helped guide the learning process so that the chefs could actually learn which ingredients work well together rather than just memorize recipes.
|
22 |
+
I trained my chefs by asking them to generate a title, a list of ingredients (including amounts!), and a list of directions after giving them just a simple list of food items.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
23 |
```text
|
24 |
[Input]
|
25 |
+
{food items*: separated by comma}
|
26 |
|
27 |
[Targets]
|
28 |
title: {TITLE} <section>
|
29 |
ingredients: {INGREDIENTS: separated by <sep>} <section>
|
30 |
directions: {DIRECTIONS: separated by <sep>}.
|
31 |
```
|
32 |
+
* In the cookbooks (a.k.a [dataset](https://huggingface.co/datasets/recipe_nlg)), the food items were referred to as NER.
|
33 |
+
In the span of a week, my chefs went from spitting out nonsense to creating masterpieces. Their learning rate was exceptionally high and each batch of recipes was better than the last. In their final exam, they achieved [high scores](
|
34 |
+
https://huggingface.co/flax-community/t5-recipe-generation#evaluation) π― in a standardized industry test and established this restaurant π². Please tell your friends and family about us! We create each recipe with a smile on our faces π€
|
35 |
+
Everyone at the restaurant is grateful for the generous support of Hugging Face and Google for hosting Flax Community week.
|
36 |
+
""".strip()
|