jclyo1 commited on
Commit
f85173a
1 Parent(s): e230ea6

ux updates

Browse files
Files changed (2) hide show
  1. main.py +23 -3
  2. static/index.html +0 -2
main.py CHANGED
@@ -44,10 +44,30 @@ def generate_image(prompt):
44
  #image = pipe(prompt, num_inference_steps=5).images[0]
45
  #image = pipe(prompt).images[0]
46
 
47
- print(image)
48
- image.save("static/ai.jpg")
49
- image.save("static/ai.png")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
50
 
 
51
 
52
 
53
  @app.get("/generate-picsum")
 
44
  #image = pipe(prompt, num_inference_steps=5).images[0]
45
  #image = pipe(prompt).images[0]
46
 
47
+ image.save("ai.jpg")
48
+
49
+
50
+ # Data to be written
51
+ assertion = {
52
+ "assertions": [
53
+ {
54
+ "label": "com.truepic.custom.ai",
55
+ "data": {
56
+ "model_name": model_id,
57
+ "model_version": "1.0",
58
+ "prompt": prompt
59
+ }
60
+ }
61
+ ]
62
+ }
63
+
64
+ json_object = json.dumps(assertion, indent=4)
65
+ with open("assertion.json", "w") as outfile:
66
+ outfile.write(json_object)
67
+
68
+ subprocess.check_output(['./truepic-sign', 'sign', 'ai.jpg', '--profile', 'demo', '--assertions', 'assertion.json', '--output', (os.getcwd() + '/static/output.jpg')])
69
 
70
+ return {"response": "success"}
71
 
72
 
73
  @app.get("/generate-picsum")
static/index.html CHANGED
@@ -12,8 +12,6 @@
12
  <main>
13
  <section id="text-gen">
14
  <h1>Text to Image with Signed Attribution</h1>
15
- <img src="/ai.png" />
16
- <img src="/ai.jpg" />
17
  <truepic-display><img src="/output.jpg" /></truepic-display>
18
  <form class="text-gen-form" style="padding:40px 0;">
19
  <label for="text-gen-input">Enter number between 0 and 999: </label>
 
12
  <main>
13
  <section id="text-gen">
14
  <h1>Text to Image with Signed Attribution</h1>
 
 
15
  <truepic-display><img src="/output.jpg" /></truepic-display>
16
  <form class="text-gen-form" style="padding:40px 0;">
17
  <label for="text-gen-input">Enter number between 0 and 999: </label>