-
Notifications
You must be signed in to change notification settings - Fork 261
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Docker image with DeepDanbooru #94
Comments
The models are under releases. |
I have created a Dockerfile with and without the model: https://github.com/kamuridesu/DeepDanbooru
Although it does not have any API but isn't so hard, I may create one later. Also, check https://github.com/kamuridesu/deepdanbooryu, a project using events and Docker to create a fully scalable backend if you're interested. |
Thank you, I'm definitely waiting for a docker image with API. If anyone else is interested in using DeepDanbooru through docker you can: linux windows for the image in |
A simple Web API implementation for import os
import deepdanbooru
from io import BytesIO
from deepdanbooru.commands import evaluate_image
from flask import Flask, request, render_template
PROJECT_PATH = os.path.abspath("model")
print("Loading model")
MODEL = deepdanbooru.project.load_model_from_project(
PROJECT_PATH, compile_model=False
)
print("Loading tags")
TAGS = deepdanbooru.project.load_tags_from_project(PROJECT_PATH)
app = Flask("deepdanbooru", template_folder=os.path.abspath("templates"))
@app.route("/")
def index():
return render_template("index.html")
@app.route("/upload", methods=["POST"])
async def upload():
if "file" not in request.files:
return "No file uploaded!"
file = request.files["file"]
result = evaluate_image(BytesIO(file.stream.read()), MODEL, TAGS, 0.5)
results = {}
for tag, score in result:
results[tag] = float(f"{score:05.3f}")
return results
if __name__ == "__main__":
app.run(debug=True, host="0.0.0.0", port="8080") The model is stored in a subdir called <!DOCTYPE html>
<html>
<head>
<title>File Upload</title>
</head>
<body>
<h1>Upload a File</h1>
<form action="/upload" method="POST" enctype="multipart/form-data">
<input type="file" name="file" accept="*">
<input type="submit" value="Upload">
</form>
</body>
</html> |
@kamuridesu I took your example and added it to a DDB scripts repo at https://github.com/sky-cake/ddb_scripts. The scripts also include an image crawler which saves tags and scores in a db. |
Is there any docker image with some kind of HTTP API (like your demo)?
If there is none I would like to make one, but I have zero knowledge in Python development, maybe you have some tips?
I also don't see the trained model, only instructions on how to make my own. Can I just download it from somewhere?
The way I see it:
Am I right?
The text was updated successfully, but these errors were encountered: