Skip to content
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

Add hashdata api endpoint #19

Merged
merged 2 commits into from
Aug 12, 2019
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Add hashdata api endpoint
  • Loading branch information
olivercoad authored Aug 11, 2019
commit 89cb426a054557f104beb59f174d62383d49f1b2
9 changes: 8 additions & 1 deletion src/server/checkface.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import numpy as np
import queue
import hashlib
from flask import send_file, request
from flask import send_file, request, jsonify
np.set_printoptions(threshold=np.inf)

import flask
Expand Down Expand Up @@ -148,6 +148,13 @@ def image_generation(hash):
print(f"Image file {name} already exists")
return send_file(name, mimetype='image/jpg')

@app.route('/api/hashdata/<path:hash>', methods=['GET'])
def hashlatentdata(hash):
os.makedirs("outputImages", exist_ok=True)
seed = int(hashlib.sha256(hash.encode('utf-8')).hexdigest(), 16) % 10**8
latent = fromSeed(Gs, seed)
return jsonify({ "seed": seed, "qlatent": latent})

def worker():
dnnlib.tflib.init_tf()
Gs = fetch_model()
Expand Down