jamino30 commited on
Commit
1435716
1 Parent(s): a84e446

Upload folder using huggingface_hub

Browse files
Files changed (1) hide show
  1. app.py +5 -16
app.py CHANGED
@@ -83,6 +83,7 @@ style_options = {
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
 
@@ -107,7 +108,7 @@ def inference(content_image, style_image, style_strength, progress=gr.Progress(t
107
  generated_img = content_img.clone().requires_grad_(True)
108
  optimizer = optim.Adam([generated_img], lr=lr)
109
 
110
- for _ in tqdm(range(iters)):
111
  generated_features = model(generated_img)
112
  content_features = model(content_img)
113
  style_features = model(style_img)
@@ -146,7 +147,7 @@ with gr.Blocks(title='🖼️ Neural Style Transfer') as demo:
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)
152
  with gr.Row():
@@ -161,23 +162,11 @@ with gr.Blocks(title='🖼️ Neural Style Transfer') as demo:
161
 
162
  examples = gr.Examples(
163
  examples=[
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),
181
  )
182
 
183
  demo.launch(show_api=True)
 
83
  'Lego Bricks': 'LegoBricks.jpg',
84
  'Oil Painting': 'OilPainting.jpg',
85
  'Mosaic': 'Mosaic.jpg',
86
+ '8Bit': '8Bit.jpg',
87
  }
88
  style_options = {k: f'./style_images/{v}' for k, v in style_options.items()}
89
 
 
108
  generated_img = content_img.clone().requires_grad_(True)
109
  optimizer = optim.Adam([generated_img], lr=lr)
110
 
111
+ for _ in tqdm(range(iters), desc='The magic is happening ✨'):
112
  generated_features = model(generated_img)
113
  content_features = model(content_img)
114
  style_features = model(style_img)
 
147
  with gr.Column():
148
  content_image = gr.Image(label='Content', type='pil', sources=['upload'])
149
  style_dropdown = gr.Radio(choices=list(style_options.keys()), label='Style', value='Starry Night', type='value')
150
+ with gr.Accordion('Adjustments', open=False):
151
  with gr.Group():
152
  style_strength_slider = gr.Slider(label='Style Strength', minimum=0, maximum=100, step=5, value=50)
153
  with gr.Row():
 
162
 
163
  examples = gr.Examples(
164
  examples=[
 
165
  ['./content_images/TajMahal.jpg', 'Starry Night', 75],
166
  ['./content_images/GoldenRetriever.jpg', 'Lego Bricks', 50],
167
+ ['./content_images/SeaTurtle.jpg', 'Mosaic', 100]
 
 
 
 
 
 
 
 
 
 
168
  ],
169
+ inputs=[content_image, style_dropdown, style_strength_slider]
 
170
  )
171
 
172
  demo.launch(show_api=True)