Spaces:
Runtime error
Runtime error
Update merged_app2.py
Browse files- merged_app2.py +20 -0
merged_app2.py
CHANGED
|
@@ -863,6 +863,8 @@ def process(input_fg, prompt, image_width, image_height, num_samples, seed, step
|
|
| 863 |
|
| 864 |
return pixels
|
| 865 |
|
|
|
|
|
|
|
| 866 |
def extract_foreground(image):
|
| 867 |
if image is None:
|
| 868 |
return None, gr.update(visible=True), gr.update(visible=True)
|
|
@@ -1864,11 +1866,29 @@ with gr.Blocks() as app:
|
|
| 1864 |
output_image.render()
|
| 1865 |
transfer_btn = gr.Button("Send to relight")
|
| 1866 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1867 |
def send_img(img_result):
|
| 1868 |
return img_result
|
| 1869 |
|
| 1870 |
transfer_btn.click(send_img, [output_image], [input_fg])
|
| 1871 |
|
|
|
|
|
|
|
| 1872 |
|
| 1873 |
generate_btn.click(
|
| 1874 |
fn=generate_image,
|
|
|
|
| 863 |
|
| 864 |
return pixels
|
| 865 |
|
| 866 |
+
@spaces.GPU(duration=60)
|
| 867 |
+
@torch.inference_mode()
|
| 868 |
def extract_foreground(image):
|
| 869 |
if image is None:
|
| 870 |
return None, gr.update(visible=True), gr.update(visible=True)
|
|
|
|
| 1866 |
output_image.render()
|
| 1867 |
transfer_btn = gr.Button("Send to relight")
|
| 1868 |
|
| 1869 |
+
with gr.Tab("Caption"):
|
| 1870 |
+
with gr.Row():
|
| 1871 |
+
gr.Markdown("## Describe Image")
|
| 1872 |
+
with gr.Row():
|
| 1873 |
+
with gr.Column():
|
| 1874 |
+
with gr.Row():
|
| 1875 |
+
image_to_describe = gr.Image(type="pil", label="Image", height=480)
|
| 1876 |
+
with gr.Row():
|
| 1877 |
+
with gr.Group():
|
| 1878 |
+
describe_button = gr.Button(value="Describe Image")
|
| 1879 |
+
description_text = gr.Textbox(
|
| 1880 |
+
label="Output",
|
| 1881 |
+
placeholder="",
|
| 1882 |
+
value=""
|
| 1883 |
+
)
|
| 1884 |
+
|
| 1885 |
def send_img(img_result):
|
| 1886 |
return img_result
|
| 1887 |
|
| 1888 |
transfer_btn.click(send_img, [output_image], [input_fg])
|
| 1889 |
|
| 1890 |
+
# describe_button.click(describe_image, [image_to_describe], [description_text])
|
| 1891 |
+
|
| 1892 |
|
| 1893 |
generate_btn.click(
|
| 1894 |
fn=generate_image,
|