vskode commited on
Commit ·
bb948a4
1
Parent(s): 5977b69
modify st_annotate so that users can upload files, still in developlment
Browse files
acodet/front_end/st_annotate.py
CHANGED
|
@@ -110,14 +110,31 @@ class PresetInterfaceSettings:
|
|
| 110 |
"""
|
| 111 |
Interface options when inference is selected, i.e. preset options 0 or 1.
|
| 112 |
"""
|
| 113 |
-
path = st.text_input(
|
| 114 |
-
|
| 115 |
-
|
| 116 |
-
|
| 117 |
-
)
|
| 118 |
-
|
| 119 |
-
|
| 120 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 121 |
self.config["thresh"] = utils.validate_float(
|
| 122 |
utils.user_input(
|
| 123 |
"Model threshold:", "0.9", help=help_strings.THRESHOLD
|
|
|
|
| 110 |
"""
|
| 111 |
Interface options when inference is selected, i.e. preset options 0 or 1.
|
| 112 |
"""
|
| 113 |
+
# path = st.text_input(
|
| 114 |
+
# "Enter the path to your sound data:",
|
| 115 |
+
# "tests/test_files",
|
| 116 |
+
# help=help_strings.ENTER_PATH,
|
| 117 |
+
# )
|
| 118 |
+
files = st.file_uploader("Choose your sound files (make sure they a time stamp of some format)",
|
| 119 |
+
accept_multiple_files=True)
|
| 120 |
+
# also hier kommen die files als so file objekte rein
|
| 121 |
+
# ich muss irgendwie festlegen dass sie immer am selben ordner landen
|
| 122 |
+
# und das er sich die ganze verzeichnis check sache spart. ich kann die
|
| 123 |
+
# nicht in dieser json abspeichern, also reiche ich die entweder direkt weiter
|
| 124 |
+
# oder ich lad sie erst da hoch wo sie gebraucht werden
|
| 125 |
+
# oder ich speicher sie hier erstmal ab. ist dann bisschen doppelt gemoppelt
|
| 126 |
+
# aber dafuer muss sich die struktur so wenig wie moeglich aendern
|
| 127 |
+
import librosa as lb
|
| 128 |
+
import soundfile as sf
|
| 129 |
+
self.config["sound_files_source"] = 'user_audio_uploads'
|
| 130 |
+
|
| 131 |
+
if len(files) > 0:
|
| 132 |
+
# if len(list(Path(self.config["sound_files_source"]).iterdir())) == 0:
|
| 133 |
+
for ind, file in enumerate(files):
|
| 134 |
+
st.progress(ind/len(files), 'Checking files...')
|
| 135 |
+
audio, sr = lb.load(file)
|
| 136 |
+
sf.write('user_audio_uploads/' + file.name, audio, sr)
|
| 137 |
+
|
| 138 |
self.config["thresh"] = utils.validate_float(
|
| 139 |
utils.user_input(
|
| 140 |
"Model threshold:", "0.9", help=help_strings.THRESHOLD
|