Spaces:
Sleeping
Sleeping
syntax
Browse files
app.py
CHANGED
@@ -11,31 +11,28 @@ DEPLOYMENT_URIS = {
|
|
11 |
|
12 |
|
13 |
def generate_image(model_selection, lora_scale, guidance_scale, prompt_strength, num_steps, prompt):
|
14 |
-
|
15 |
-
|
16 |
-
#
|
17 |
-
# prediction = deployment.predictions.create(
|
18 |
-
# input={
|
19 |
-
# "model": "dev",
|
20 |
-
# "lora_scale": lora_scale,
|
21 |
-
# "num_outputs": 1,
|
22 |
-
# "aspect_ratio": "1:1",
|
23 |
-
# "output_format": "webp",
|
24 |
-
# "guidance_scale": guidance_scale,
|
25 |
-
# "output_quality": 90,
|
26 |
-
# "prompt_strength": prompt_strength,
|
27 |
-
# "extra_lora_scale": 1,
|
28 |
-
# "num_inference_steps": num_steps,
|
29 |
-
# "prompt": prompt
|
30 |
-
# }
|
31 |
-
# )
|
32 |
-
|
33 |
-
# prediction.wait()
|
34 |
-
# output = prediction.output
|
35 |
-
# image_url = output[0] if output else None
|
36 |
|
37 |
-
|
38 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
39 |
|
40 |
return image_url
|
41 |
|
|
|
11 |
|
12 |
|
13 |
def generate_image(model_selection, lora_scale, guidance_scale, prompt_strength, num_steps, prompt):
|
14 |
+
deployment_uri = DEPLOYMENT_URIS[model_selection]
|
15 |
+
deployment = replicate.deployments.get(deployment_uri)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
16 |
|
17 |
+
prediction = deployment.predictions.create(
|
18 |
+
input={
|
19 |
+
"model": "dev",
|
20 |
+
"lora_scale": lora_scale,
|
21 |
+
"num_outputs": 1,
|
22 |
+
"aspect_ratio": "1:1",
|
23 |
+
"output_format": "webp",
|
24 |
+
"guidance_scale": guidance_scale,
|
25 |
+
"output_quality": 90,
|
26 |
+
"prompt_strength": prompt_strength,
|
27 |
+
"extra_lora_scale": 1,
|
28 |
+
"num_inference_steps": num_steps,
|
29 |
+
"prompt": prompt
|
30 |
+
}
|
31 |
+
)
|
32 |
+
|
33 |
+
prediction.wait()
|
34 |
+
output = prediction.output
|
35 |
+
image_url = output[0] if output else None
|
36 |
|
37 |
return image_url
|
38 |
|