MsChabane commited on
Commit
3e888ff
·
verified ·
1 Parent(s): 8661bef

update main

Browse files
Files changed (1) hide show
  1. main.py +9 -1
main.py CHANGED
@@ -93,7 +93,7 @@ def index(req:Request):
93
  def index(req:Request):
94
  return templates.TemplateResponse('ImageInterpretation.html',{'request':req})
95
 
96
- app.post("/caption2")
97
  async def generate_caption(file: UploadFile = File(...)):
98
  contents = await file.read()
99
  image = Image.open(io.BytesIO(contents)).convert("RGB")
@@ -104,7 +104,15 @@ async def generate_caption(file: UploadFile = File(...)):
104
  caption = interpreter_tokenizer.decode(output_ids[0], skip_special_tokens=True)
105
 
106
  return {"caption": caption}
 
 
 
 
 
 
107
 
 
 
108
  @app.post("/caption")
109
  def caption(file:UploadFile=File(...)):
110
  extension = file.filename.split(".")[-1]
 
93
  def index(req:Request):
94
  return templates.TemplateResponse('ImageInterpretation.html',{'request':req})
95
 
96
+ @app.post("/caption2")
97
  async def generate_caption(file: UploadFile = File(...)):
98
  contents = await file.read()
99
  image = Image.open(io.BytesIO(contents)).convert("RGB")
 
104
  caption = interpreter_tokenizer.decode(output_ids[0], skip_special_tokens=True)
105
 
106
  return {"caption": caption}
107
+ @app.post('/get')
108
+ def g(f:str):
109
+ return generator(f)[0]["generated_text"]
110
+ @app.post('/gets')
111
+ def g(f:str):
112
+ return summarizer(f)[0]['summary_text']
113
 
114
+
115
+
116
  @app.post("/caption")
117
  def caption(file:UploadFile=File(...)):
118
  extension = file.filename.split(".")[-1]