Spaces:
Sleeping
Sleeping
rando
Browse files
main.py
CHANGED
@@ -31,7 +31,7 @@ def generate_image(prompt, inference_steps, model):
|
|
31 |
#pipe.scheduler = DPMSolverMultistepScheduler.from_config(pipe.scheduler.config)
|
32 |
#pipe = pipe.to("cuda")
|
33 |
|
34 |
-
pipeline = DiffusionPipeline.from_pretrained(
|
35 |
#pipeline = pipeline.to("cuda")
|
36 |
generator = torch.Generator("cpu").manual_seed(0)
|
37 |
pipeline.scheduler = DPMSolverMultistepScheduler.from_config(pipeline.scheduler.config)
|
@@ -44,11 +44,12 @@ def generate_image(prompt, inference_steps, model):
|
|
44 |
#image = pipe(prompt, num_inference_steps=5).images[0]
|
45 |
#image = pipe(prompt).images[0]
|
46 |
|
47 |
-
|
|
|
48 |
|
49 |
#print(f"after filename assignment")
|
50 |
|
51 |
-
image.save(
|
52 |
|
53 |
#print(f"after save")
|
54 |
|
@@ -71,7 +72,7 @@ def generate_image(prompt, inference_steps, model):
|
|
71 |
with open("assertion.json", "w") as outfile:
|
72 |
outfile.write(json_object)
|
73 |
|
74 |
-
subprocess.check_output(['./truepic-sign', 'sign',
|
75 |
|
76 |
return {"response": "success"}
|
77 |
|
|
|
31 |
#pipe.scheduler = DPMSolverMultistepScheduler.from_config(pipe.scheduler.config)
|
32 |
#pipe = pipe.to("cuda")
|
33 |
|
34 |
+
pipeline = DiffusionPipeline.from_pretrained(str(model))
|
35 |
#pipeline = pipeline.to("cuda")
|
36 |
generator = torch.Generator("cpu").manual_seed(0)
|
37 |
pipeline.scheduler = DPMSolverMultistepScheduler.from_config(pipeline.scheduler.config)
|
|
|
44 |
#image = pipe(prompt, num_inference_steps=5).images[0]
|
45 |
#image = pipe(prompt).images[0]
|
46 |
|
47 |
+
|
48 |
+
filename = str(uuid.uuid4()) + ".jpg"
|
49 |
|
50 |
#print(f"after filename assignment")
|
51 |
|
52 |
+
image.save(filename)
|
53 |
|
54 |
#print(f"after save")
|
55 |
|
|
|
72 |
with open("assertion.json", "w") as outfile:
|
73 |
outfile.write(json_object)
|
74 |
|
75 |
+
subprocess.check_output(['./truepic-sign', 'sign', filename, '--profile', 'demo', '--assertions', 'assertion.json', '--output', (os.getcwd() + '/static/output.jpg')])
|
76 |
|
77 |
return {"response": "success"}
|
78 |
|