jhj0517
commited on
Commit
·
b2fcecf
1
Parent(s):
6736291
Add folder open button
Browse files
app.py
CHANGED
|
@@ -48,6 +48,7 @@ class App:
|
|
| 48 |
img_out = gr.Image(label=_("Output Image"))
|
| 49 |
with gr.Column(scale=2):
|
| 50 |
expression_parameters = self.create_parameters()
|
|
|
|
| 51 |
with gr.Accordion("Opt in features", visible=False):
|
| 52 |
img_sample = gr.Image()
|
| 53 |
img_motion_link = gr.Image()
|
|
@@ -63,12 +64,22 @@ class App:
|
|
| 63 |
outputs=img_out
|
| 64 |
)
|
| 65 |
|
|
|
|
|
|
|
|
|
|
| 66 |
btn_gen.click(self.inferencer.edit_expression,
|
| 67 |
inputs=params + opt_in_features_params,
|
| 68 |
outputs=img_out)
|
| 69 |
|
| 70 |
self.app.launch(inbrowser=True)
|
| 71 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 72 |
|
| 73 |
app = App()
|
| 74 |
app.launch()
|
|
|
|
| 48 |
img_out = gr.Image(label=_("Output Image"))
|
| 49 |
with gr.Column(scale=2):
|
| 50 |
expression_parameters = self.create_parameters()
|
| 51 |
+
btn_openfolder = gr.Button('📂')
|
| 52 |
with gr.Accordion("Opt in features", visible=False):
|
| 53 |
img_sample = gr.Image()
|
| 54 |
img_motion_link = gr.Image()
|
|
|
|
| 64 |
outputs=img_out
|
| 65 |
)
|
| 66 |
|
| 67 |
+
btn_openfolder.click(
|
| 68 |
+
fn=lambda: self.open_folder(self.args.output_dir), inputs=None, outputs=None
|
| 69 |
+
)
|
| 70 |
btn_gen.click(self.inferencer.edit_expression,
|
| 71 |
inputs=params + opt_in_features_params,
|
| 72 |
outputs=img_out)
|
| 73 |
|
| 74 |
self.app.launch(inbrowser=True)
|
| 75 |
|
| 76 |
+
@staticmethod
|
| 77 |
+
def open_folder(folder_path: str):
|
| 78 |
+
if not os.path.exists(folder_path):
|
| 79 |
+
os.makedirs(folder_path, exist_ok=True)
|
| 80 |
+
print(f"The directory path {folder_path} has newly created.")
|
| 81 |
+
os.system(f"start {folder_path}")
|
| 82 |
+
|
| 83 |
|
| 84 |
app = App()
|
| 85 |
app.launch()
|