Spaces:
Sleeping
Sleeping
syntax
Browse files
app.py
CHANGED
@@ -1,5 +1,6 @@
|
|
1 |
import gradio as gr
|
2 |
import replicate
|
|
|
3 |
|
4 |
|
5 |
DEPLOYMENT_URIS = {
|
@@ -10,28 +11,32 @@ DEPLOYMENT_URIS = {
|
|
10 |
|
11 |
|
12 |
def generate_image(model_selection, lora_scale, guidance_scale, prompt_strength, num_steps, prompt):
|
13 |
-
deployment_uri = DEPLOYMENT_URIS[model_selection]
|
14 |
-
deployment = replicate.deployments.get(deployment_uri)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
15 |
|
16 |
-
prediction
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
"guidance_scale": guidance_scale,
|
24 |
-
"output_quality": 90,
|
25 |
-
"prompt_strength": prompt_strength,
|
26 |
-
"extra_lora_scale": 1,
|
27 |
-
"num_inference_steps": num_steps,
|
28 |
-
"prompt": prompt
|
29 |
-
}
|
30 |
-
)
|
31 |
-
|
32 |
-
prediction.wait()
|
33 |
-
output = prediction.output
|
34 |
-
image_url = output[0] if output else None
|
35 |
return image_url
|
36 |
|
37 |
|
|
|
1 |
import gradio as gr
|
2 |
import replicate
|
3 |
+
import time
|
4 |
|
5 |
|
6 |
DEPLOYMENT_URIS = {
|
|
|
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 |
+
time.sleep(20)
|
38 |
+
image_url = "https://external-content.duckduckgo.com/iu/?u=https%3A%2F%2Fi1.sndcdn.com%2Fartworks-000207677710-z7mg8u-t500x500.jpg&f=1&nofb=1&ipt=54d62f19e1816c166bec632275277c4118a940853b2cd93d1c673ea487d9dfee&ipo=images"
|
39 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
40 |
return image_url
|
41 |
|
42 |
|