Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -18,13 +18,7 @@ def read_content(file_path: str) -> str:
|
|
| 18 |
|
| 19 |
def predict(prompt, negative_prompt, guidance_scale, num_inference_steps, scheduler, lora, lora_weight):
|
| 20 |
pipeline.safety_checker = lambda images, **kwargs: (images, [False] * len(images))
|
| 21 |
-
|
| 22 |
-
lora = "profaker/add_detail_lora"
|
| 23 |
-
if lora == "nursing_job":
|
| 24 |
-
lora = "profaker/Nursing_job_lora"
|
| 25 |
-
if lora == "nsfw_POV":
|
| 26 |
-
lora = "profaker/NSFW_POV_lora"
|
| 27 |
-
pipeline.load_lora_weights(lora)
|
| 28 |
|
| 29 |
scheduler_class_name = scheduler.split("-")[0]
|
| 30 |
add_kwargs = {}
|
|
@@ -34,7 +28,27 @@ def predict(prompt, negative_prompt, guidance_scale, num_inference_steps, schedu
|
|
| 34 |
add_kwargs["algorithm_type"] = "sde-dpmsolver++"
|
| 35 |
scheduler = getattr(diffusers, scheduler_class_name)
|
| 36 |
pipeline.scheduler = scheduler.from_pretrained("emilianJR/epiCRealism", subfolder="scheduler", **add_kwargs)
|
| 37 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 38 |
images = pipeline(
|
| 39 |
prompt=prompt,
|
| 40 |
negative_prompt=negative_prompt,
|
|
@@ -100,8 +114,8 @@ with image_blocks as demo:
|
|
| 100 |
scheduler = gr.Dropdown(label="Schedulers", choices=schedulers,
|
| 101 |
value="DPMSolverMultistepScheduler-Karras")
|
| 102 |
with gr.Row(equal_height=True):
|
| 103 |
-
lora = ['add_detail', 'nursing_job', 'nsfw_POV']
|
| 104 |
-
lora = gr.Dropdown(label='Lora', choices=lora, value="
|
| 105 |
lora_weight = [-1, -0.5, 0, 0.5, 1]
|
| 106 |
lora_weight = gr.Dropdown(label="Lora Weights", choices=lora_weight, value=0.5)
|
| 107 |
with gr.Row(equal_height=True):
|
|
|
|
| 18 |
|
| 19 |
def predict(prompt, negative_prompt, guidance_scale, num_inference_steps, scheduler, lora, lora_weight):
|
| 20 |
pipeline.safety_checker = lambda images, **kwargs: (images, [False] * len(images))
|
| 21 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 22 |
|
| 23 |
scheduler_class_name = scheduler.split("-")[0]
|
| 24 |
add_kwargs = {}
|
|
|
|
| 28 |
add_kwargs["algorithm_type"] = "sde-dpmsolver++"
|
| 29 |
scheduler = getattr(diffusers, scheduler_class_name)
|
| 30 |
pipeline.scheduler = scheduler.from_pretrained("emilianJR/epiCRealism", subfolder="scheduler", **add_kwargs)
|
| 31 |
+
if lora == "add_detail":
|
| 32 |
+
lora = "profaker/add_detail_lora"
|
| 33 |
+
if lora == "nursing_job":
|
| 34 |
+
lora = "profaker/Nursing_job_lora"
|
| 35 |
+
if lora == "nsfw_POV":
|
| 36 |
+
lora = "profaker/NSFW_POV_lora"
|
| 37 |
+
if lora == "None":
|
| 38 |
+
images = pipeline(
|
| 39 |
+
prompt=prompt,
|
| 40 |
+
negative_prompt=negative_prompt,
|
| 41 |
+
num_inference_steps=int(num_inference_steps),
|
| 42 |
+
guidance_scale=guidance_scale
|
| 43 |
+
).images[0]
|
| 44 |
+
print("Prompt", prompt)
|
| 45 |
+
print("Negative", negative_prompt)
|
| 46 |
+
print("Steps", num_inference_steps)
|
| 47 |
+
print("Scale", guidance_scale)
|
| 48 |
+
print("Scheduler", scheduler)
|
| 49 |
+
return images
|
| 50 |
+
|
| 51 |
+
pipeline.load_lora_weights(lora)
|
| 52 |
images = pipeline(
|
| 53 |
prompt=prompt,
|
| 54 |
negative_prompt=negative_prompt,
|
|
|
|
| 114 |
scheduler = gr.Dropdown(label="Schedulers", choices=schedulers,
|
| 115 |
value="DPMSolverMultistepScheduler-Karras")
|
| 116 |
with gr.Row(equal_height=True):
|
| 117 |
+
lora = ['None','add_detail', 'nursing_job', 'nsfw_POV']
|
| 118 |
+
lora = gr.Dropdown(label='Lora', choices=lora, value="None")
|
| 119 |
lora_weight = [-1, -0.5, 0, 0.5, 1]
|
| 120 |
lora_weight = gr.Dropdown(label="Lora Weights", choices=lora_weight, value=0.5)
|
| 121 |
with gr.Row(equal_height=True):
|