jsvs commited on
Commit
db2db1f
·
1 Parent(s): 7dae219

refactor(app): add generates method

Browse files
Files changed (1) hide show
  1. app.py +8 -1
app.py CHANGED
@@ -38,4 +38,11 @@ def generate(text: str):
38
 
39
  # Return the generated text in a JSON response
40
  return {"output": output[0]["generated_text"]}
41
-
 
 
 
 
 
 
 
 
38
 
39
  # Return the generated text in a JSON response
40
  return {"output": output[0]["generated_text"]}
41
+
42
+ @app.get("/generates")
43
+ def generate(topic: str,question:str,context:str,n: int):
44
+ text = "Tópico: {} Questão: {} Context: {}".format(topic,question,context)
45
+ output = pipe(text,num_return_sequences=n,num_beams=n)
46
+
47
+ # Return the generated text in a JSON response
48
+ return {"output": [output[i]["generated_text"] for i in range(len(output))]}