sander-wood commited on
Commit
1321bba
1 Parent(s): 2c2a2e1

Upload app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -1
app.py CHANGED
@@ -125,6 +125,11 @@ class ABCTokenizer():
125
 
126
  def generate_abc(control_codes, prefix, num_tunes, max_length, top_p, temperature, seed):
127
 
 
 
 
 
 
128
  prefix = unidecode(control_codes + prefix)
129
  tokenizer = ABCTokenizer()
130
  model = GPT2LMHeadModel.from_pretrained('sander-wood/tunesformer').to(device)
@@ -175,7 +180,7 @@ input_num_tunes = gr.inputs.Slider(minimum=1, maximum=10, step=1, default=3, lab
175
  input_max_length = gr.inputs.Slider(minimum=10, maximum=1000, step=10, default=500, label="Max Length")
176
  input_top_p = gr.inputs.Slider(minimum=0.0, maximum=1.0, step=0.05, default=0.9, label="Top P")
177
  input_temperature = gr.inputs.Slider(minimum=0.0, maximum=1.0, step=0.05, default=0.9, label="Temperature")
178
- input_seed = gr.inputs.Textbox(lines=1, label="Seed", default="None")
179
  output_abc = gr.outputs.Textbox(label="Generated Tunes")
180
 
181
  gr.Interface(generate_abc,
 
125
 
126
  def generate_abc(control_codes, prefix, num_tunes, max_length, top_p, temperature, seed):
127
 
128
+ try:
129
+ seed = int(seed)
130
+ except:
131
+ seed = None
132
+
133
  prefix = unidecode(control_codes + prefix)
134
  tokenizer = ABCTokenizer()
135
  model = GPT2LMHeadModel.from_pretrained('sander-wood/tunesformer').to(device)
 
180
  input_max_length = gr.inputs.Slider(minimum=10, maximum=1000, step=10, default=500, label="Max Length")
181
  input_top_p = gr.inputs.Slider(minimum=0.0, maximum=1.0, step=0.05, default=0.9, label="Top P")
182
  input_temperature = gr.inputs.Slider(minimum=0.0, maximum=1.0, step=0.05, default=0.9, label="Temperature")
183
+ input_seed = gr.inputs.Textbox(lines=1, label="Seed (int)", default="None")
184
  output_abc = gr.outputs.Textbox(label="Generated Tunes")
185
 
186
  gr.Interface(generate_abc,