jclyo1 commited on
Commit
d630363
1 Parent(s): f05e9cf
Files changed (1) hide show
  1. main.py +6 -2
main.py CHANGED
@@ -8,6 +8,7 @@ import logging
8
  import urllib.request
9
  import os
10
  import json
 
11
 
12
  import torch
13
  from diffusers import DiffusionPipeline, DPMSolverMultistepScheduler
@@ -43,8 +44,11 @@ def generate_image(prompt, inference_steps, model):
43
  #image = pipe(prompt, num_inference_steps=5).images[0]
44
  #image = pipe(prompt).images[0]
45
 
46
- image.save("ai.jpg")
 
 
47
 
 
48
 
49
  # Data to be written
50
  assertion = {
@@ -64,7 +68,7 @@ def generate_image(prompt, inference_steps, model):
64
  with open("assertion.json", "w") as outfile:
65
  outfile.write(json_object)
66
 
67
- subprocess.check_output(['./truepic-sign', 'sign', 'ai.jpg', '--profile', 'demo', '--assertions', 'assertion.json', '--output', (os.getcwd() + '/static/output.jpg')])
68
 
69
  return {"response": "success"}
70
 
 
8
  import urllib.request
9
  import os
10
  import json
11
+ import uuid
12
 
13
  import torch
14
  from diffusers import DiffusionPipeline, DPMSolverMultistepScheduler
 
44
  #image = pipe(prompt, num_inference_steps=5).images[0]
45
  #image = pipe(prompt).images[0]
46
 
47
+ filename = str(uuid.uuid4()) + ".jpg"
48
+
49
+ image.save(filename)
50
 
51
+ print(filename)
52
 
53
  # Data to be written
54
  assertion = {
 
68
  with open("assertion.json", "w") as outfile:
69
  outfile.write(json_object)
70
 
71
+ subprocess.check_output(['./truepic-sign', 'sign', filename, '--profile', 'demo', '--assertions', 'assertion.json', '--output', (os.getcwd() + '/static/output.jpg')])
72
 
73
  return {"response": "success"}
74