Yash Sachdeva commited on
Commit
1c519c8
·
1 Parent(s): 2b5014a
Files changed (1) hide show
  1. question_paper.py +5 -2
question_paper.py CHANGED
@@ -4,7 +4,7 @@ from fastapi.middleware.cors import CORSMiddleware
4
  from fastapi.encoders import jsonable_encoder
5
  from fastapi.responses import JSONResponse
6
 
7
- pipe_flan = pipeline("text2text-generation", model="google/flan-t5-small", max_new_tokens=1024)
8
 
9
  app = FastAPI()
10
 
@@ -32,7 +32,10 @@ def llama():
32
  # print(tresponse)
33
  input = "Generate 5 jokes"
34
  output = pipe_flan(input)
35
- response_message = {"message": output[0]["generated_text"]}
 
 
 
36
  json_response = jsonable_encoder(response_message)
37
  return JSONResponse(content=json_response)
38
 
 
4
  from fastapi.encoders import jsonable_encoder
5
  from fastapi.responses import JSONResponse
6
 
7
+ pipe_flan = pipeline("text2text-generation", model="google/flan-t5-small", max_new_tokens=500)
8
 
9
  app = FastAPI()
10
 
 
32
  # print(tresponse)
33
  input = "Generate 5 jokes"
34
  output = pipe_flan(input)
35
+ text = ""
36
+ for o in output:
37
+ text = text + ' ' + o["generated_text"]
38
+ response_message = {"message": text}
39
  json_response = jsonable_encoder(response_message)
40
  return JSONResponse(content=json_response)
41