Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -20,7 +20,7 @@ def generate_recipe(recipe_name):
|
|
20 |
"""Generate cooking method given a recipe name."""
|
21 |
prompt = f"Recipe Name: {recipe_name}\nInstructions: "
|
22 |
inputs = tokenizer(prompt, return_tensors="pt")
|
23 |
-
outputs = model.generate(inputs["input_ids"], max_length=512,temperature=0.
|
24 |
top_p=0.9, num_return_sequences=1, do_sample=True)
|
25 |
generated_text = tokenizer.decode(outputs[0], skip_special_tokens=True)
|
26 |
# Return only the method part, splitting after 'Method:'
|
|
|
20 |
"""Generate cooking method given a recipe name."""
|
21 |
prompt = f"Recipe Name: {recipe_name}\nInstructions: "
|
22 |
inputs = tokenizer(prompt, return_tensors="pt")
|
23 |
+
outputs = model.generate(inputs["input_ids"], max_length=512,temperature=0.7, # Sampling randomness
|
24 |
top_p=0.9, num_return_sequences=1, do_sample=True)
|
25 |
generated_text = tokenizer.decode(outputs[0], skip_special_tokens=True)
|
26 |
# Return only the method part, splitting after 'Method:'
|