tidalove commited on
Commit
12f1b5a
·
verified ·
1 Parent(s): 68ca7bf

add adjustable size

Browse files
Files changed (1) hide show
  1. app.py +5 -4
app.py CHANGED
@@ -5,7 +5,7 @@ import zipfile
5
  import shutil
6
  from test_api import run_adain
7
 
8
- def process_adain_api(files, style_strength=1.0):
9
  '''API endpoint for AdaIN processing.'''
10
  if not files:
11
  return None, "No files uploaded"
@@ -27,7 +27,7 @@ def process_adain_api(files, style_strength=1.0):
27
  style_dataset_pth = "tidalove/paleo-real"
28
 
29
  # Run AdaIN
30
- result_path = run_adain(input_dir, style_dataset_pth, output_dir, style_strength)
31
 
32
  # Create zip file
33
  zip_path = os.path.join(temp_dir, "style_transfer_results.zip")
@@ -48,7 +48,8 @@ with gr.Blocks() as adain_demo:
48
  with gr.Row():
49
  with gr.Column():
50
  files_input = gr.File(label="Upload Images", file_count="multiple", file_types=["image"])
51
- strength_input = gr.Slider(0.0, 2.0, 1.0, step=0.1, label="Style Strength")
 
52
  process_btn = gr.Button("Process", variant="primary")
53
 
54
  with gr.Column():
@@ -57,7 +58,7 @@ with gr.Blocks() as adain_demo:
57
 
58
  process_btn.click(
59
  fn=process_adain_api,
60
- inputs=[files_input, strength_input],
61
  outputs=[download_output, status_output],
62
  api_name="adain_process" # This creates the API endpoint
63
  )
 
5
  import shutil
6
  from test_api import run_adain
7
 
8
+ def process_adain_api(files, style_strength=1.0, dataset_size=100):
9
  '''API endpoint for AdaIN processing.'''
10
  if not files:
11
  return None, "No files uploaded"
 
27
  style_dataset_pth = "tidalove/paleo-real"
28
 
29
  # Run AdaIN
30
+ run_adain(input_dir, style_dataset_pth, output_dir, style_strength, dataset_size)
31
 
32
  # Create zip file
33
  zip_path = os.path.join(temp_dir, "style_transfer_results.zip")
 
48
  with gr.Row():
49
  with gr.Column():
50
  files_input = gr.File(label="Upload Images", file_count="multiple", file_types=["image"])
51
+ strength_input = gr.Slider(0.0, 2.0, 1.0, step=0.1, label="Style strength")
52
+ size_input = gr.Slider(1, 1000, 100, step=10, label="Generated dataset size")
53
  process_btn = gr.Button("Process", variant="primary")
54
 
55
  with gr.Column():
 
58
 
59
  process_btn.click(
60
  fn=process_adain_api,
61
+ inputs=[files_input, strength_input, size_input],
62
  outputs=[download_output, status_output],
63
  api_name="adain_process" # This creates the API endpoint
64
  )