Spaces:
Runtime error
Runtime error
victor commited on
Commit ·
40f2de2
1
Parent(s): 9832cc7
refactor(app): add multiple generation method
Browse files36 unmodified lines3738394040414243444546474836 unmodified lines output = pipe(text) # Return the generated text in a JSON response return {"output": output[0]["generated_text"]} return {"output": output[0]["generated_text"]}
@app.get("/generates")def generate(topic: str,question:str,context:str,n: int): text = "Tópico: {} Questão: {} Context: {}".format(topic,question,context) output = pipe(text,num_return_sequences=n,num_beams=n) # Return the generated text in a JSON response return {"output": [output[i]["generated_text"] for i in range(len(output))]}app.py+9-1