add gallery
Browse files
app.py
CHANGED
@@ -36,7 +36,7 @@ def process_adain_api(files, style_strength=1.0, dataset_size=100):
|
|
36 |
if file.lower().endswith(('.jpg', '.jpeg', '.png')):
|
37 |
zipf.write(os.path.join(output_dir, file), file)
|
38 |
|
39 |
-
return zip_path, f"Style transfer completed with strength {style_strength}"
|
40 |
|
41 |
except Exception as e:
|
42 |
return None, f"Error: {str(e)}"
|
@@ -53,13 +53,14 @@ with gr.Blocks() as adain_demo:
|
|
53 |
process_btn = gr.Button("Process", variant="primary")
|
54 |
|
55 |
with gr.Column():
|
|
|
56 |
download_output = gr.File(label="Download Results")
|
57 |
status_output = gr.Textbox(label="Status", interactive=False)
|
58 |
|
59 |
process_btn.click(
|
60 |
fn=process_adain_api,
|
61 |
inputs=[files_input, strength_input, size_input],
|
62 |
-
outputs=[download_output, status_output],
|
63 |
api_name="adain_process" # This creates the API endpoint
|
64 |
)
|
65 |
|
|
|
36 |
if file.lower().endswith(('.jpg', '.jpeg', '.png')):
|
37 |
zipf.write(os.path.join(output_dir, file), file)
|
38 |
|
39 |
+
return [os.path.join(output_dir, basename) for basename in os.listdir(output_dir)], zip_path, f"Style transfer completed with strength {style_strength}"
|
40 |
|
41 |
except Exception as e:
|
42 |
return None, f"Error: {str(e)}"
|
|
|
53 |
process_btn = gr.Button("Process", variant="primary")
|
54 |
|
55 |
with gr.Column():
|
56 |
+
gallery_output = gr.Gallery(label="Gallery", columns=3, rows=2, object_fit="contain")
|
57 |
download_output = gr.File(label="Download Results")
|
58 |
status_output = gr.Textbox(label="Status", interactive=False)
|
59 |
|
60 |
process_btn.click(
|
61 |
fn=process_adain_api,
|
62 |
inputs=[files_input, strength_input, size_input],
|
63 |
+
outputs=[gallery_output, download_output, status_output],
|
64 |
api_name="adain_process" # This creates the API endpoint
|
65 |
)
|
66 |
|