Spaces:
Sleeping
Sleeping
Upload folder using huggingface_hub
Browse files- .gitattributes +1 -0
- app.py +12 -2
- style_images/Mosaic.jpg +3 -0
- style_images/Scream.jpg +2 -2
.gitattributes
CHANGED
@@ -36,3 +36,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
36 |
style_images/Scream.jpg filter=lfs diff=lfs merge=lfs -text
|
37 |
style_images/StarryNight.jpg filter=lfs diff=lfs merge=lfs -text
|
38 |
content_images/Scream.jpg filter=lfs diff=lfs merge=lfs -text
|
|
|
|
36 |
style_images/Scream.jpg filter=lfs diff=lfs merge=lfs -text
|
37 |
style_images/StarryNight.jpg filter=lfs diff=lfs merge=lfs -text
|
38 |
content_images/Scream.jpg filter=lfs diff=lfs merge=lfs -text
|
39 |
+
style_images/Mosaic.jpg filter=lfs diff=lfs merge=lfs -text
|
app.py
CHANGED
@@ -10,7 +10,9 @@ import torchvision.transforms as transforms
|
|
10 |
import torchvision.models as models
|
11 |
import gradio as gr
|
12 |
|
13 |
-
|
|
|
|
|
14 |
print('DEVICE:', device)
|
15 |
|
16 |
class VGG_19(nn.Module):
|
@@ -73,10 +75,14 @@ def save_img(img, original_size):
|
|
73 |
|
74 |
|
75 |
style_options = {
|
|
|
76 |
'Starry Night': 'StarryNight.jpg',
|
77 |
'Great Wave': 'GreatWave.jpg',
|
|
|
|
|
78 |
'Lego Bricks': 'LegoBricks.jpg',
|
79 |
'Oil Painting': 'OilPainting.jpg',
|
|
|
80 |
}
|
81 |
style_options = {k: f'./style_images/{v}' for k, v in style_options.items()}
|
82 |
|
@@ -139,7 +145,7 @@ with gr.Blocks(title='🖼️ Neural Style Transfer') as demo:
|
|
139 |
with gr.Row():
|
140 |
with gr.Column():
|
141 |
content_image = gr.Image(label='Content', type='pil', sources=['upload'])
|
142 |
-
style_dropdown = gr.
|
143 |
with gr.Accordion('Advanced Settings', open=False):
|
144 |
with gr.Group():
|
145 |
style_strength_slider = gr.Slider(label='Style Strength', minimum=0, maximum=100, step=5, value=50)
|
@@ -158,13 +164,17 @@ with gr.Blocks(title='🖼️ Neural Style Transfer') as demo:
|
|
158 |
# page 1
|
159 |
['./content_images/TajMahal.jpg', 'Starry Night', 75],
|
160 |
['./content_images/GoldenRetriever.jpg', 'Lego Bricks', 50],
|
|
|
161 |
['./content_images/Beach.jpg', 'Oil Painting', 50],
|
162 |
['./content_images/StandingOnCliff.png', 'Great Wave', 75],
|
|
|
163 |
# page 2
|
164 |
['./content_images/Surfer.jpg', 'Starry Night', 75],
|
165 |
['./content_images/CameraGirl.jpg', 'Lego Bricks', 50],
|
|
|
166 |
['./content_images/NYCSkyline.jpg', 'Oil Painting', 50],
|
167 |
['./content_images/GoldenRetriever.jpg', 'Great Wave', 75],
|
|
|
168 |
],
|
169 |
inputs=[content_image, style_dropdown, style_strength_slider],
|
170 |
examples_per_page=len(style_options),
|
|
|
10 |
import torchvision.models as models
|
11 |
import gradio as gr
|
12 |
|
13 |
+
if torch.cuda.is_available(): device = 'cuda'
|
14 |
+
elif torch.backends.mps.is_available(): device = 'mps'
|
15 |
+
else: device = 'cpu'
|
16 |
print('DEVICE:', device)
|
17 |
|
18 |
class VGG_19(nn.Module):
|
|
|
75 |
|
76 |
|
77 |
style_options = {
|
78 |
+
# famous paintings
|
79 |
'Starry Night': 'StarryNight.jpg',
|
80 |
'Great Wave': 'GreatWave.jpg',
|
81 |
+
'Scream': 'Scream.jpg',
|
82 |
+
# styles
|
83 |
'Lego Bricks': 'LegoBricks.jpg',
|
84 |
'Oil Painting': 'OilPainting.jpg',
|
85 |
+
'Mosaic': 'Mosaic.jpg',
|
86 |
}
|
87 |
style_options = {k: f'./style_images/{v}' for k, v in style_options.items()}
|
88 |
|
|
|
145 |
with gr.Row():
|
146 |
with gr.Column():
|
147 |
content_image = gr.Image(label='Content', type='pil', sources=['upload'])
|
148 |
+
style_dropdown = gr.Radio(choices=list(style_options.keys()), label='Style', value='Starry Night', type='value')
|
149 |
with gr.Accordion('Advanced Settings', open=False):
|
150 |
with gr.Group():
|
151 |
style_strength_slider = gr.Slider(label='Style Strength', minimum=0, maximum=100, step=5, value=50)
|
|
|
164 |
# page 1
|
165 |
['./content_images/TajMahal.jpg', 'Starry Night', 75],
|
166 |
['./content_images/GoldenRetriever.jpg', 'Lego Bricks', 50],
|
167 |
+
['./content_images/PaintedLadies.jpg', 'Scream', 50],
|
168 |
['./content_images/Beach.jpg', 'Oil Painting', 50],
|
169 |
['./content_images/StandingOnCliff.png', 'Great Wave', 75],
|
170 |
+
['./content_images/SeaTurtle.jpg', 'Mosaic', 100],
|
171 |
# page 2
|
172 |
['./content_images/Surfer.jpg', 'Starry Night', 75],
|
173 |
['./content_images/CameraGirl.jpg', 'Lego Bricks', 50],
|
174 |
+
['./content_images/SeaTurtle.jpg', 'Scream', 50],
|
175 |
['./content_images/NYCSkyline.jpg', 'Oil Painting', 50],
|
176 |
['./content_images/GoldenRetriever.jpg', 'Great Wave', 75],
|
177 |
+
['./content_images/TajMahal.jpg', 'Mosaic', 100],
|
178 |
],
|
179 |
inputs=[content_image, style_dropdown, style_strength_slider],
|
180 |
examples_per_page=len(style_options),
|
style_images/Mosaic.jpg
ADDED
Git LFS Details
|
style_images/Scream.jpg
CHANGED
Git LFS Details
|
Git LFS Details
|