jamino30 commited on
Commit
b6b1222
1 Parent(s): b9f6209

Upload folder using huggingface_hub

Browse files
Files changed (1) hide show
  1. app.py +1 -24
app.py CHANGED
@@ -22,15 +22,6 @@ for param in model.parameters():
22
 
23
  style_files = os.listdir('./style_images')
24
  style_options = {' '.join(style_file.split('.')[0].split('_')): f'./style_images/{style_file}' for style_file in style_files}
25
- optimal_settings = {
26
- 'Starry Night': (100, False),
27
- 'Lego Bricks': (100, False),
28
- 'Mosaic': (100, False),
29
- 'Oil Painting': (100, False),
30
- 'Scream': (75, True),
31
- 'Great Wave': (75, False),
32
- 'Watercolor': (75, False),
33
- }
34
 
35
  cached_style_features = {}
36
  for style_name, style_img_path in style_options.items():
@@ -73,9 +64,6 @@ def run(content_image, style_name, style_strength, output_quality, progress=gr.P
73
  def set_slider(value):
74
  return gr.update(value=value)
75
 
76
- def update_settings(style):
77
- return optimal_settings.get(style, (100, False))
78
-
79
  css = """
80
  #container {
81
  margin: 0 auto;
@@ -87,7 +75,7 @@ with gr.Blocks(css=css) as demo:
87
  gr.HTML("<h1 style='text-align: center; padding: 10px'>🖼️ Neural Style Transfer</h1>")
88
  with gr.Column(elem_id='container'):
89
  content_and_output = gr.Image(label='Content', show_label=False, type='pil', sources=['upload', 'webcam', 'clipboard'], format='jpg', show_download_button=False)
90
- style_dropdown = gr.Radio(choices=list(style_options.keys()), label='Style', info='Note: Adjustments automatically optimize for different styles.', value='Starry Night', type='value')
91
 
92
  with gr.Accordion('Adjustments', open=True):
93
  with gr.Group():
@@ -127,17 +115,6 @@ with gr.Blocks(css=css) as demo:
127
  outputs=[download_button]
128
  )
129
 
130
- style_dropdown.change(
131
- fn=lambda style: set_slider(update_settings(style)[0]),
132
- inputs=[style_dropdown],
133
- outputs=[style_strength_slider]
134
- )
135
- style_dropdown.change(
136
- fn=lambda style: gr.update(value=update_settings(style)[1]),
137
- inputs=[style_dropdown],
138
- outputs=[output_quality]
139
- )
140
-
141
  examples = gr.Examples(
142
  label='Example',
143
  examples=[['./content_images/Bridge.jpg', 'Starry Night', 100, False]],
 
22
 
23
  style_files = os.listdir('./style_images')
24
  style_options = {' '.join(style_file.split('.')[0].split('_')): f'./style_images/{style_file}' for style_file in style_files}
 
 
 
 
 
 
 
 
 
25
 
26
  cached_style_features = {}
27
  for style_name, style_img_path in style_options.items():
 
64
  def set_slider(value):
65
  return gr.update(value=value)
66
 
 
 
 
67
  css = """
68
  #container {
69
  margin: 0 auto;
 
75
  gr.HTML("<h1 style='text-align: center; padding: 10px'>🖼️ Neural Style Transfer</h1>")
76
  with gr.Column(elem_id='container'):
77
  content_and_output = gr.Image(label='Content', show_label=False, type='pil', sources=['upload', 'webcam', 'clipboard'], format='jpg', show_download_button=False)
78
+ style_dropdown = gr.Radio(choices=list(style_options.keys()), label='Style', value='Starry Night', type='value')
79
 
80
  with gr.Accordion('Adjustments', open=True):
81
  with gr.Group():
 
115
  outputs=[download_button]
116
  )
117
 
 
 
 
 
 
 
 
 
 
 
 
118
  examples = gr.Examples(
119
  label='Example',
120
  examples=[['./content_images/Bridge.jpg', 'Starry Night', 100, False]],