Spaces:
Runtime error
Runtime error
new method
Browse files
app.py
CHANGED
|
@@ -24,7 +24,14 @@ def generate(text: str):
|
|
| 24 |
can be found [here](<https://huggingface.co/google/flan-t5-small>).
|
| 25 |
"""
|
| 26 |
# Use the pipeline to generate text from the given input text
|
| 27 |
-
output = pipe(text)
|
| 28 |
|
| 29 |
# Return the generated text in a JSON response
|
| 30 |
-
return {"output": output[0]["generated_text"]}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 24 |
can be found [here](<https://huggingface.co/google/flan-t5-small>).
|
| 25 |
"""
|
| 26 |
# Use the pipeline to generate text from the given input text
|
| 27 |
+
output = pipe("contexto: "+text)
|
| 28 |
|
| 29 |
# Return the generated text in a JSON response
|
| 30 |
+
return {"output": output[0]["generated_text"]}
|
| 31 |
+
|
| 32 |
+
@app.get("/generateQuestion")
|
| 33 |
+
def generate(text: str,n: int):
|
| 34 |
+
output = pipe("contexto: "+text,num_return_sequences=n,num_beams=n)
|
| 35 |
+
|
| 36 |
+
# Return the generated text in a JSON response
|
| 37 |
+
return {"output": [output[i]["generated_text"] for i in len(output)]}
|