autotag: fix bug when reading file from stdin.
Another attempt at fixing #2. b216057 had a bug where you couldn't pass
a file through stdin because we tried to read the file twice, which we
can't do if the input is a pipe.
This commit is contained in:
@@ -4,6 +4,7 @@ from os import getenv
|
||||
from dotenv import load_dotenv
|
||||
from autotagger import Autotagger
|
||||
from base64 import b64encode
|
||||
from fastai.vision.core import PILImage
|
||||
from flask import Flask, request, render_template, jsonify, abort
|
||||
from werkzeug.exceptions import HTTPException
|
||||
|
||||
@@ -26,7 +27,8 @@ def evaluate():
|
||||
output = request.values.get("format", "html")
|
||||
limit = int(request.values.get("limit", 50))
|
||||
|
||||
predictions = autotagger.predict(files, threshold=threshold, limit=limit)
|
||||
images = [PILImage.create(file) for file in files]
|
||||
predictions = autotagger.predict(images, threshold=threshold, limit=limit)
|
||||
|
||||
if output == "html":
|
||||
for file in files:
|
||||
|
||||
Reference in New Issue
Block a user