Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -44,7 +44,9 @@ def on_model_change(model):
|
|
| 44 |
pipe = pipe.to("cuda")
|
| 45 |
|
| 46 |
def inference(prompt, negPrompt, guidance, steps, width_input, height_input):
|
| 47 |
-
|
|
|
|
|
|
|
| 48 |
promptPrev = prompt
|
| 49 |
prompt = prompt_prefixes[current_model] + prompt
|
| 50 |
results = pipe(prompt, negative_prompt = negPrompt, num_inference_steps=int(steps), guidance_scale=guidance, width=width_input, height=height_input)
|
|
@@ -52,7 +54,7 @@ def inference(prompt, negPrompt, guidance, steps, width_input, height_input):
|
|
| 52 |
return image, gr.update(visible=True), gr.update(visible=True), gr.update(visible=True), gr.update(placeholder=promptPrev)
|
| 53 |
|
| 54 |
def inference_example(prompt, negPrompt, guidance, steps, width_input, height_input):
|
| 55 |
-
|
| 56 |
prompt = prompt_prefixes[current_model] + prompt
|
| 57 |
results = pipe(prompt, negative_prompt = negPrompt, num_inference_steps=int(steps), guidance_scale=guidance, width=width_input, height=height_input)
|
| 58 |
image = results.images[0] if not results.nsfw_content_detected[0] else Image.open("nsfw_placeholder.jpg")
|
|
|
|
| 44 |
pipe = pipe.to("cuda")
|
| 45 |
|
| 46 |
def inference(prompt, negPrompt, guidance, steps, width_input, height_input):
|
| 47 |
+
print("Generated image with prompt: " + prompt)
|
| 48 |
+
if negPrompt != "":
|
| 49 |
+
print("Negative prompt: " + negPrompt)
|
| 50 |
promptPrev = prompt
|
| 51 |
prompt = prompt_prefixes[current_model] + prompt
|
| 52 |
results = pipe(prompt, negative_prompt = negPrompt, num_inference_steps=int(steps), guidance_scale=guidance, width=width_input, height=height_input)
|
|
|
|
| 54 |
return image, gr.update(visible=True), gr.update(visible=True), gr.update(visible=True), gr.update(placeholder=promptPrev)
|
| 55 |
|
| 56 |
def inference_example(prompt, negPrompt, guidance, steps, width_input, height_input):
|
| 57 |
+
|
| 58 |
prompt = prompt_prefixes[current_model] + prompt
|
| 59 |
results = pipe(prompt, negative_prompt = negPrompt, num_inference_steps=int(steps), guidance_scale=guidance, width=width_input, height=height_input)
|
| 60 |
image = results.images[0] if not results.nsfw_content_detected[0] else Image.open("nsfw_placeholder.jpg")
|