Files changed (1) hide show
  1. app.py +23 -0
app.py CHANGED
@@ -1,6 +1,29 @@
1
  import gradio as gr
 
2
  from huggingface_hub import InferenceClient
3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4
  """
5
  For more information on `huggingface_hub` Inference API support, please check the docs: https://huggingface.co/docs/huggingface_hub/v0.22.2/en/guides/inference
6
  """
 
1
  import gradio as gr
2
+ import requests
3
  from huggingface_hub import InferenceClient
4
 
5
+ SPOONACULAR_API_KEY = "71259036cfb3405aa5d49c1220a988c5"
6
+
7
+ def get_recipes(ingredient):
8
+ url = "https://api.spoonacular.com/recipes/complexSearch"
9
+ params = {
10
+ "query": ingredient,
11
+ "number": 3,
12
+ "apiKey": SPOONACULAR_API_KEY
13
+ }
14
+ res = requests.get(url, params=params)
15
+ data = res.json()
16
+ return [r["title"] for r in data["results"]]
17
+
18
+ iface = gr.Interface(
19
+ fn=get_recipes,
20
+ inputs="text",
21
+ outputs="text",
22
+ title="Spoonacular Recipe Finder"
23
+ )
24
+
25
+ iface.launch()
26
+
27
  """
28
  For more information on `huggingface_hub` Inference API support, please check the docs: https://huggingface.co/docs/huggingface_hub/v0.22.2/en/guides/inference
29
  """