Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -13,14 +13,24 @@ image_to_text = pipeline("image-to-text", model="Salesforce/blip-image-captionin
|
|
13 |
def generate_recipe(description):
|
14 |
url = "https://api-inference.huggingface.co/models/Qwen/Qwen2.5-72B-Instruct"
|
15 |
headers = {"Authorization": f"Bearer {hf_token}"}
|
16 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
17 |
prompt = (
|
18 |
-
f"
|
19 |
-
"
|
20 |
)
|
|
|
21 |
payload = {
|
22 |
"inputs": prompt,
|
23 |
-
"parameters": {
|
|
|
|
|
|
|
24 |
}
|
25 |
|
26 |
response = requests.post(url, headers=headers, json=payload)
|
|
|
13 |
def generate_recipe(description):
|
14 |
url = "https://api-inference.huggingface.co/models/Qwen/Qwen2.5-72B-Instruct"
|
15 |
headers = {"Authorization": f"Bearer {hf_token}"}
|
16 |
+
|
17 |
+
# Añade el system input para definir el rol del modelo
|
18 |
+
system_input = (
|
19 |
+
"Act as a professional chef. Your task is to explain to a regular person "
|
20 |
+
"how to cook a given dish, providing a step-by-step guide and a list of ingredients with exact quantities."
|
21 |
+
)
|
22 |
+
|
23 |
prompt = (
|
24 |
+
f"{system_input} The dish is described as: {description}. "
|
25 |
+
"Provide a list of ingredients followed by detailed cooking instructions."
|
26 |
)
|
27 |
+
|
28 |
payload = {
|
29 |
"inputs": prompt,
|
30 |
+
"parameters": {
|
31 |
+
"max_length": 5000, # Maximum length for the response
|
32 |
+
"min_length": 2000 # Minimum length for the response
|
33 |
+
}
|
34 |
}
|
35 |
|
36 |
response = requests.post(url, headers=headers, json=payload)
|