asigalov61 commited on
Commit
cd1a8cb
·
verified ·
1 Parent(s): e1e4abb

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +21 -1
app.py CHANGED
@@ -13,6 +13,7 @@ import copy
13
  from collections import Counter
14
  import random
15
  import statistics
 
16
 
17
  import gradio as gr
18
 
@@ -61,6 +62,25 @@ def format_table_data(data_string):
61
 
62
  #==========================================================================================================
63
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
64
  def ID_MIDI(input_midi):
65
 
66
  print('*' * 70)
@@ -133,7 +153,7 @@ def ID_MIDI(input_midi):
133
 
134
  output_midi_src_dataset = output_entry[0]
135
 
136
- output_midi_path_str = TMIDIX.clean_string(output_entry[1], regex=r'[^a-zA-Z0-9 .()\n]+')
137
 
138
  client = InferenceClient(api_key=HF_TOKEN)
139
 
 
13
  from collections import Counter
14
  import random
15
  import statistics
16
+ import re
17
 
18
  import gradio as gr
19
 
 
62
 
63
  #==========================================================================================================
64
 
65
+ def clean_string(original_string,
66
+ regex=r'[^a-zA-Z0-9 \n]',
67
+ remove_duplicate_spaces=True,
68
+ title=False
69
+ ):
70
+
71
+ cstr1 = re.sub(regex, '', original_string)
72
+
73
+ if title:
74
+ cstr1 = cstr1.title()
75
+
76
+ if remove_duplicate_spaces:
77
+ return re.sub(r'[ ]+', ' ', cstr1).strip()
78
+
79
+ else:
80
+ return cstr1
81
+
82
+ #==========================================================================================================
83
+
84
  def ID_MIDI(input_midi):
85
 
86
  print('*' * 70)
 
153
 
154
  output_midi_src_dataset = output_entry[0]
155
 
156
+ output_midi_path_str = clean_string(output_entry[1])
157
 
158
  client = InferenceClient(api_key=HF_TOKEN)
159