Update app.py
Browse files
app.py
CHANGED
@@ -89,21 +89,10 @@ with gr.Blocks() as demo:
|
|
89 |
],
|
90 |
outputs=[output_image, output_mask],
|
91 |
)
|
92 |
-
iface = gr.Interface(
|
93 |
-
extract_image,
|
94 |
-
[
|
95 |
-
gr.Textbox(label="Positive prompts"),
|
96 |
-
gr.Textbox(label="Negative prompts"),
|
97 |
-
gr.Image(type="pil"),
|
98 |
-
gr.Slider(minimum=0, maximum=1, value=0.4, label="Threshold"),
|
99 |
-
],
|
100 |
-
[gr.Image(label="Result")], # Only return the final image
|
101 |
-
"textbox,textbox,image,slider", # Match the directory name (without mask)
|
102 |
-
"image",
|
103 |
-
title="CLIPSeg API",
|
104 |
-
)
|
105 |
-
|
106 |
-
# Launch both UI and API
|
107 |
-
demo.launch()
|
108 |
-
iface.launch(share=True)
|
109 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
89 |
],
|
90 |
outputs=[output_image, output_mask],
|
91 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
92 |
|
93 |
+
# Gradio API Endpoint
|
94 |
+
gr.Interface(
|
95 |
+
[positive_prompts, negative_prompts, input_image, input_slider_T],
|
96 |
+
[output_image, output_mask],
|
97 |
+
live=True,
|
98 |
+
).launch()
|