m3hrdadfi commited on
Commit
1ab93bd
1 Parent(s): 07a328d

Add more examples and fix list bug

Browse files
Files changed (2) hide show
  1. examples.py +4 -0
  2. utils.py +7 -1
examples.py CHANGED
@@ -1,6 +1,10 @@
1
  EXAMPLES = {
 
 
2
  "Persian Chicken Stew (Fesenjan)": "walnut pieces, onion, boneless skinless chicken thighs, pomegranate molasses, orange juice, chicken stock, cinnamon, salt, pepper, oil",
3
  "Pide (Turkish Flatbread)": "water, dry active yeast, flour, salt, olive oil, ground beef, onion, pepper, salt, feta cheese, parsley, lemon",
4
  "Chocolate Baklava": "phyllo dough, unsalted butter, walnuts, cinnamon, water, honey, melted chocolate",
5
  "Korean Pork Chops": "pork chops, soy sauce, honey, garlic, sesame oil, fresh ginger root, sweet chili sauce, olive oil",
 
 
6
  }
1
  EXAMPLES = {
2
+ "Ghormeh Sabzi (Persian Herb Stew)": "beef, oil, onion, tomatoes, turmeric powder, limes, water, salt, pepper, red beans, herb",
3
+ "Kotlet, Persian Cutlet": "beef, potatoes, eggs, onion, flour, turmeric powder, oil, salt, pepper",
4
  "Persian Chicken Stew (Fesenjan)": "walnut pieces, onion, boneless skinless chicken thighs, pomegranate molasses, orange juice, chicken stock, cinnamon, salt, pepper, oil",
5
  "Pide (Turkish Flatbread)": "water, dry active yeast, flour, salt, olive oil, ground beef, onion, pepper, salt, feta cheese, parsley, lemon",
6
  "Chocolate Baklava": "phyllo dough, unsalted butter, walnuts, cinnamon, water, honey, melted chocolate",
7
  "Korean Pork Chops": "pork chops, soy sauce, honey, garlic, sesame oil, fresh ginger root, sweet chili sauce, olive oil",
8
+ "Italian Pasta Salad": "rotini pasta, broccoli florets, parmesan cheese, red pepper, onions, black olives",
9
+ "Authentic German Jägerschnitzel (Hunter Schnitzel with Mushroom Gravy)": "oil, boneless pork chops, salt, pepper, flour, eggs, breadcrumbs, gravy, parsley"
10
  }
utils.py CHANGED
@@ -35,8 +35,14 @@ def remote_css(css_url):
35
  st.markdown(f'<link href="{css_url}" rel="stylesheet">', unsafe_allow_html=True)
36
 
37
 
 
 
 
 
 
 
38
  def pure_comma_separation(list_str, return_list=True):
39
- r = [item.strip() for item in list_str.split(",")]
40
  # r = list(set([x.strip() for x in list_str.strip().split(',') if len(x.strip()) > 0]))
41
  if return_list:
42
  return r
35
  st.markdown(f'<link href="{css_url}" rel="stylesheet">', unsafe_allow_html=True)
36
 
37
 
38
+ def unique_list(seq):
39
+ seen = set()
40
+ seen_add = seen.add
41
+ return [x for x in seq if not (x in seen or seen_add(x))]
42
+
43
+
44
  def pure_comma_separation(list_str, return_list=True):
45
+ r = unique_list([item.strip() for item in list_str.lower().split(",") if item.strip()])
46
  # r = list(set([x.strip() for x in list_str.strip().split(',') if len(x.strip()) > 0]))
47
  if return_list:
48
  return r