Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -3,8 +3,8 @@ from huggingface_hub import hf_hub_download
|
|
3 |
|
4 |
Rain_Princess = hf_hub_download(repo_id="maze/FastStyleTransfer", filename="Rain_Princess_512.pth")
|
5 |
The_Scream = hf_hub_download(repo_id="maze/FastStyleTransfer", filename="Scream_512.pth")
|
6 |
-
|
7 |
-
|
8 |
|
9 |
|
10 |
import numpy as np
|
@@ -141,6 +141,10 @@ def main(image, backbone, style):
|
|
141 |
transformer.load_state_dict(torch.load(The_Scream, map_location=torch.device('cpu')))
|
142 |
elif style == "Rain Princess":
|
143 |
transformer.load_state_dict(torch.load(Rain_Princess, map_location=torch.device('cpu')))
|
|
|
|
|
|
|
|
|
144 |
else:
|
145 |
transformer.load_state_dict(torch.load(Rain_Princess, map_location=torch.device('cpu')))
|
146 |
image = Image.fromarray(image)
|
@@ -157,7 +161,7 @@ gr.Interface(
|
|
157 |
inputs = [
|
158 |
gr.inputs.Image(),
|
159 |
gr.inputs.Radio(["VGG19", "Robust ResNet50", "Standard ResNet50"], label="Backbone"),
|
160 |
-
gr.inputs.Dropdown(["The Scream", "Rain Princess"], type="value", default="Rain Princess", label="style")
|
161 |
],
|
162 |
outputs = [gr.outputs.Image(label="Stylized"), gr.outputs.HTML(label="Comment")],
|
163 |
# examples = [
|
|
|
3 |
|
4 |
Rain_Princess = hf_hub_download(repo_id="maze/FastStyleTransfer", filename="Rain_Princess_512.pth")
|
5 |
The_Scream = hf_hub_download(repo_id="maze/FastStyleTransfer", filename="Scream_512.pth")
|
6 |
+
The_Mosaic = hf_hub_download(repo_id="maze/FastStyleTransfer", filename="Mosaic_512.pth")
|
7 |
+
Starry_Night = hf_hub_download(repo_id="maze/FastStyleTransfer", filename="Starry_Night_512.pth")
|
8 |
|
9 |
|
10 |
import numpy as np
|
|
|
141 |
transformer.load_state_dict(torch.load(The_Scream, map_location=torch.device('cpu')))
|
142 |
elif style == "Rain Princess":
|
143 |
transformer.load_state_dict(torch.load(Rain_Princess, map_location=torch.device('cpu')))
|
144 |
+
elif style == "The Mosaic":
|
145 |
+
transformer.load_state_dict(torch.load(The_Mosaic, map_location=torch.device('cpu')))
|
146 |
+
elif style == "Starry Night":
|
147 |
+
transformer.load_state_dict(torch.load(Starry_Night, map_location=torch.device('cpu')))
|
148 |
else:
|
149 |
transformer.load_state_dict(torch.load(Rain_Princess, map_location=torch.device('cpu')))
|
150 |
image = Image.fromarray(image)
|
|
|
161 |
inputs = [
|
162 |
gr.inputs.Image(),
|
163 |
gr.inputs.Radio(["VGG19", "Robust ResNet50", "Standard ResNet50"], label="Backbone"),
|
164 |
+
gr.inputs.Dropdown(["The Scream", "Rain Princess", "Starry Night", "The Mosaic"], type="value", default="Rain Princess", label="style")
|
165 |
],
|
166 |
outputs = [gr.outputs.Image(label="Stylized"), gr.outputs.HTML(label="Comment")],
|
167 |
# examples = [
|