Spaces:
Runtime error
Runtime error
Victoria Slocum
commited on
Commit
·
3e1c1d6
1
Parent(s):
62c6339
See if this works
Browse files
app.py
CHANGED
|
@@ -10,6 +10,8 @@ import spacy
|
|
| 10 |
|
| 11 |
RAPIDAPI_KEY = config('RAPIDAPI_KEY')
|
| 12 |
|
|
|
|
|
|
|
| 13 |
def get_recipe_data(recipe_url):
|
| 14 |
rapid_api_url = "https://mycookbook-io1.p.rapidapi.com/recipes/rapidapi"
|
| 15 |
|
|
@@ -22,6 +24,8 @@ def get_recipe_data(recipe_url):
|
|
| 22 |
response = requests.request("POST", rapid_api_url,
|
| 23 |
data=recipe_url, headers=headers).json()
|
| 24 |
|
|
|
|
|
|
|
| 25 |
instructions_list = response[0]['instructions'][0]['steps']
|
| 26 |
ingredients_list = response[0]['ingredients']
|
| 27 |
recipe_title = response[0]['name']
|
|
@@ -38,7 +42,6 @@ def get_recipe_data(recipe_url):
|
|
| 38 |
return instructions, ingredients, recipe_title
|
| 39 |
|
| 40 |
def get_ingredient_data(instructions, ingredients):
|
| 41 |
-
nlp = spacy.load("./model")
|
| 42 |
doc = nlp(instructions)
|
| 43 |
|
| 44 |
ingredients_list = []
|
|
|
|
| 10 |
|
| 11 |
RAPIDAPI_KEY = config('RAPIDAPI_KEY')
|
| 12 |
|
| 13 |
+
nlp = gr.Blocks.load(name='models/victorialslocum/reciparse_model')
|
| 14 |
+
|
| 15 |
def get_recipe_data(recipe_url):
|
| 16 |
rapid_api_url = "https://mycookbook-io1.p.rapidapi.com/recipes/rapidapi"
|
| 17 |
|
|
|
|
| 24 |
response = requests.request("POST", rapid_api_url,
|
| 25 |
data=recipe_url, headers=headers).json()
|
| 26 |
|
| 27 |
+
print(response)
|
| 28 |
+
|
| 29 |
instructions_list = response[0]['instructions'][0]['steps']
|
| 30 |
ingredients_list = response[0]['ingredients']
|
| 31 |
recipe_title = response[0]['name']
|
|
|
|
| 42 |
return instructions, ingredients, recipe_title
|
| 43 |
|
| 44 |
def get_ingredient_data(instructions, ingredients):
|
|
|
|
| 45 |
doc = nlp(instructions)
|
| 46 |
|
| 47 |
ingredients_list = []
|