Install native audio separator with model packages WAV tests and restore recipe
This commit is contained in:
@@ -22,7 +22,7 @@ def validate_wav(audio):
|
||||
if len(w.readframes(w.getnframes()))!=w.getnframes()*2:raise ValueError('WAV-Datei ist unvollständig.')
|
||||
except (wave.Error,EOFError):raise ValueError('Ungültige WAV-Datei.') from None
|
||||
|
||||
def read_upload(handler):
|
||||
def read_upload(handler,validate=True):
|
||||
handler.connection.settimeout(30)
|
||||
if handler.headers.get('Transfer-Encoding'):raise ValueError('Chunked Upload wird nicht unterstützt.')
|
||||
try:length=int(handler.headers.get('Content-Length','0'))
|
||||
@@ -44,7 +44,7 @@ def read_upload(handler):
|
||||
if name not in ('model','profile_id','language','response_format') or name in fields or len(data)>256:raise ValueError('Ungültiges oder doppeltes Feld.')
|
||||
try:fields[name]=data.decode('utf-8')
|
||||
except UnicodeError:raise ValueError('Ungültiges Textfeld.') from None
|
||||
validate_wav(audio)
|
||||
if validate:validate_wav(audio)
|
||||
if fields.get('response_format','json')!='json':raise ValueError('Aktuell wird response_format=json unterstützt.')
|
||||
return fields,audio
|
||||
|
||||
|
||||
Reference in New Issue
Block a user