Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -45,12 +45,12 @@ def generate_sketch(prompt, num_inference_steps, guidance_scale):
|
|
| 45 |
# Check the classification results
|
| 46 |
for result in image_classification:
|
| 47 |
if result['label'] == 'nsfw' and result['score'] > NSFW_THRESHOLD:
|
| 48 |
-
return "Inappropriate content detected. Please try another prompt." #return gr.update(visible=False),gr.Text(value="Inappropriate content detected. Please try another prompt.")
|
| 49 |
|
| 50 |
image_path = "generated_sketch.png"
|
| 51 |
|
| 52 |
image.save(image_path)
|
| 53 |
-
return image_path #gr.Image(value=image_path), gr.update(visible=False)
|
| 54 |
|
| 55 |
# Gradio interface with sliders for num_inference_steps and guidance_scale
|
| 56 |
interface = gr.Interface(
|
|
@@ -61,8 +61,8 @@ interface = gr.Interface(
|
|
| 61 |
gr.Slider(1.0, 10.0, value=3.5, step=0.1, label="Guidance Scale") # Slider for guidance_scale
|
| 62 |
],
|
| 63 |
outputs=[
|
| 64 |
-
gr.Image(
|
| 65 |
-
gr.Textbox(label="Message")
|
| 66 |
],
|
| 67 |
title="Kids Sketch Generator",
|
| 68 |
description="Enter a text prompt and generate a fun sketch for kids with customizable inference steps and guidance scale."
|
|
|
|
| 45 |
# Check the classification results
|
| 46 |
for result in image_classification:
|
| 47 |
if result['label'] == 'nsfw' and result['score'] > NSFW_THRESHOLD:
|
| 48 |
+
return None,"Inappropriate content detected. Please try another prompt." #return gr.update(visible=False),gr.Text(value="Inappropriate content detected. Please try another prompt.")
|
| 49 |
|
| 50 |
image_path = "generated_sketch.png"
|
| 51 |
|
| 52 |
image.save(image_path)
|
| 53 |
+
return image_path,None #gr.Image(value=image_path), gr.update(visible=False)
|
| 54 |
|
| 55 |
# Gradio interface with sliders for num_inference_steps and guidance_scale
|
| 56 |
interface = gr.Interface(
|
|
|
|
| 61 |
gr.Slider(1.0, 10.0, value=3.5, step=0.1, label="Guidance Scale") # Slider for guidance_scale
|
| 62 |
],
|
| 63 |
outputs=[
|
| 64 |
+
gr.Image(label="Generated Sketch"),
|
| 65 |
+
gr.Textbox(label="Message")
|
| 66 |
],
|
| 67 |
title="Kids Sketch Generator",
|
| 68 |
description="Enter a text prompt and generate a fun sketch for kids with customizable inference steps and guidance scale."
|