Spaces:
Sleeping
Sleeping
Update main.py
Browse files
main.py
CHANGED
@@ -34,27 +34,27 @@ def generate_image(prompt, inference_steps, model):
|
|
34 |
|
35 |
print(filename)
|
36 |
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
|
55 |
subprocess.check_output(['./truepic-sign', 'init', 'file-system', '--api-key', os.environ.get("api_key")])
|
56 |
-
|
57 |
-
subprocess.check_output(['./truepic-sign', 'sign', filename, '--output', (os.getcwd() + '/static/' + filename)])
|
58 |
|
59 |
return {"response": filename}
|
60 |
|
|
|
34 |
|
35 |
print(filename)
|
36 |
|
37 |
+
Data to be written
|
38 |
+
assertion = {
|
39 |
+
"assertions": [
|
40 |
+
{
|
41 |
+
"label": "com.truepic.custom.ai",
|
42 |
+
"data": {
|
43 |
+
"model_name": model,
|
44 |
+
"model_version": "1.0",
|
45 |
+
"prompt": prompt
|
46 |
+
}
|
47 |
+
}
|
48 |
+
]
|
49 |
+
}
|
50 |
|
51 |
+
json_object = json.dumps(assertion, indent=4)
|
52 |
+
with open("assertion.json", "w") as outfile:
|
53 |
+
outfile.write(json_object)
|
54 |
|
55 |
subprocess.check_output(['./truepic-sign', 'init', 'file-system', '--api-key', os.environ.get("api_key")])
|
56 |
+
subprocess.check_output(['./truepic-sign', 'sign', filename, '--assertions', 'assertion.json', '--output', (os.getcwd() + '/static/' + filename)])
|
57 |
+
# subprocess.check_output(['./truepic-sign', 'sign', filename, '--output', (os.getcwd() + '/static/' + filename)])
|
58 |
|
59 |
return {"response": filename}
|
60 |
|