Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -103,7 +103,7 @@ class ImageEditor(object):
|
|
| 103 |
|
| 104 |
model_path = self.experiment_args["model_path"]
|
| 105 |
|
| 106 |
-
ckpt = torch.load(model_path, map_location="cpu")
|
| 107 |
opts = ckpt["opts"]
|
| 108 |
|
| 109 |
opts["checkpoint_path"] = model_path
|
|
@@ -229,11 +229,10 @@ with blocks:
|
|
| 229 |
"<div>Upload an image of your face, pick your desired output styles, pick any modifiers, and apply StyleGAN-based editing.</div>"
|
| 230 |
)
|
| 231 |
with gr.Row():
|
|
|
|
|
|
|
| 232 |
with gr.Column():
|
| 233 |
-
|
| 234 |
-
|
| 235 |
-
with gr.Column():
|
| 236 |
-
style_choice = gr.inputs.CheckboxGroup(choices=editor.get_style_list(), default=editor.get_style_list(), type="value",
|
| 237 |
label="Styles")
|
| 238 |
alter = gr.Dropdown(
|
| 239 |
choices=["None", "Masculine", "Feminine", "Smiling", "Frowning", "Young", "Old", "Short Hair",
|
|
|
|
| 103 |
|
| 104 |
model_path = self.experiment_args["model_path"]
|
| 105 |
|
| 106 |
+
ckpt = torch.load(model_path, map_location="cuda:0" if torch.cuda.is_available() else "cpu")
|
| 107 |
opts = ckpt["opts"]
|
| 108 |
|
| 109 |
opts["checkpoint_path"] = model_path
|
|
|
|
| 229 |
"<div>Upload an image of your face, pick your desired output styles, pick any modifiers, and apply StyleGAN-based editing.</div>"
|
| 230 |
)
|
| 231 |
with gr.Row():
|
| 232 |
+
with gr.Column():
|
| 233 |
+
input_img = gr.Image(type="filepath", label="Input image")
|
| 234 |
with gr.Column():
|
| 235 |
+
style_choice = gr.CheckboxGroup(choices=editor.get_style_list(), default=editor.get_style_list(), type="value",
|
|
|
|
|
|
|
|
|
|
| 236 |
label="Styles")
|
| 237 |
alter = gr.Dropdown(
|
| 238 |
choices=["None", "Masculine", "Feminine", "Smiling", "Frowning", "Young", "Old", "Short Hair",
|