Spaces:
Runtime error
Runtime error
victor commited on
Commit ·
40f2de2
1
Parent(s): 9832cc7
refactor(app): add multiple generation method
Browse files36 unmodified lines3738394036 unmodified linesoutput = pipe(text)# Return the generated text in a JSON responsereturn {"output": output[0]["generated_text"]}36 unmodified lines37383940414243444546474836 unmodified linesoutput = pipe(text)# Return the generated text in a JSON responsereturn {"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 responsereturn {"output": [output[i]["generated_text"] for i in range(len(output))]}
app.py+9-1