Skip to content

Commit

Permalink
remove unnecessary tasks
Browse files Browse the repository at this point in the history
  • Loading branch information
listofbanned committed Oct 29, 2022
1 parent 4f93d86 commit 13bb654
Showing 1 changed file with 0 additions and 12 deletions.
12 changes: 0 additions & 12 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,18 +109,6 @@ async def upload_image(task: str, img_url: str):
# nucleus sampling
# caption = model.generate(image, sample=True, top_p=0.9, max_length=20, min_length=5)
return {'Caption': caption[0]}
if task == 'vqa':
with torch.no_grad():
caption = vqa_model.generate(image, sample=False, num_beams=3, max_length=20, min_length=5)
return {'Caption': caption[0]}
if task == 'feature_extraction':
with torch.no_grad():
caption = feature_extraction_model.generate(image, sample=False, num_beams=3, max_length=20, min_length=5)
return {'Caption': caption[0]}
if task == 'text_matching':
with torch.no_grad():
caption = image_text_matching_model.generate(image, sample=False, num_beams=3, max_length=20, min_length=5)
return {'Caption': caption[0]}
except Exception as e:
return {'Error': e}

Expand Down

0 comments on commit 13bb654

Please sign in to comment.