hello
Browse files
app.py
CHANGED
|
@@ -1,23 +1,17 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
from huggingface_hub import InferenceClient
|
| 3 |
|
|
|
|
| 4 |
|
| 5 |
-
|
| 6 |
|
| 7 |
-
def
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
response =
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
temperature=0.2
|
| 18 |
-
)
|
| 19 |
-
return response['choices'][0]['message']['content'].strip()
|
| 20 |
-
|
| 21 |
-
chatbot = gr.ChatInterface(respond, type="messages")
|
| 22 |
-
chatbot.launch()
|
| 23 |
-
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
from huggingface_hub import InferenceClient
|
| 3 |
|
| 4 |
+
import requests
|
| 5 |
|
| 6 |
+
API_KEY = "71259036cfb3405aa5d49c1220a988c5"
|
| 7 |
|
| 8 |
+
def search_recipes(query):
|
| 9 |
+
url = "https://api.spoonacular.com/recipes/complexSearch"
|
| 10 |
+
params = {
|
| 11 |
+
"query": query,
|
| 12 |
+
"number": 5,
|
| 13 |
+
"apiKey": API_KEY
|
| 14 |
+
}
|
| 15 |
+
response = requests.get(url, params=params)
|
| 16 |
+
data = response.json()
|
| 17 |
+
return data["results"]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|