Update app.py
Browse files
app.py
CHANGED
@@ -16,6 +16,9 @@ from PIL import Image
|
|
16 |
import numpy as np
|
17 |
from model import ContentLoss, gram_matrix, StyleLoss, image_transform, get_input_optimizer,get_style_model_and_losses
|
18 |
|
|
|
|
|
|
|
19 |
#Defining the Model
|
20 |
cnn = models.vgg19(pretrained=True).features.eval()
|
21 |
|
@@ -25,7 +28,6 @@ cnn_normalization_mean = torch.tensor([0.485, 0.456, 0.406])
|
|
25 |
cnn_normalization_std = torch.tensor([0.229, 0.224, 0.225])
|
26 |
|
27 |
|
28 |
-
|
29 |
## style_transfer
|
30 |
import numpy as np
|
31 |
def run_style_transfer(cnn, normalization_mean, normalization_std,
|
@@ -131,8 +133,8 @@ example_list = [["examples/" + example] for example in os.listdir("examples")]
|
|
131 |
demo = gr.Interface(
|
132 |
fn=style_transfer,
|
133 |
inputs=[
|
134 |
-
gr.
|
135 |
-
gr.
|
136 |
],
|
137 |
examples=example_list,
|
138 |
outputs="image",
|
@@ -143,5 +145,5 @@ demo = gr.Interface(
|
|
143 |
)
|
144 |
|
145 |
# Launch the Gradio interface
|
146 |
-
demo.launch(debug=True)
|
147 |
|
|
|
16 |
import numpy as np
|
17 |
from model import ContentLoss, gram_matrix, StyleLoss, image_transform, get_input_optimizer,get_style_model_and_losses
|
18 |
|
19 |
+
|
20 |
+
|
21 |
+
|
22 |
#Defining the Model
|
23 |
cnn = models.vgg19(pretrained=True).features.eval()
|
24 |
|
|
|
28 |
cnn_normalization_std = torch.tensor([0.229, 0.224, 0.225])
|
29 |
|
30 |
|
|
|
31 |
## style_transfer
|
32 |
import numpy as np
|
33 |
def run_style_transfer(cnn, normalization_mean, normalization_std,
|
|
|
133 |
demo = gr.Interface(
|
134 |
fn=style_transfer,
|
135 |
inputs=[
|
136 |
+
gr.Image(label="content Image"),
|
137 |
+
gr.Image(label="style_image")
|
138 |
],
|
139 |
examples=example_list,
|
140 |
outputs="image",
|
|
|
145 |
)
|
146 |
|
147 |
# Launch the Gradio interface
|
148 |
+
demo.launch(debug=True, share=True)
|
149 |
|