MCPcopy
hub / github.com/OpenMotionLab/MotionGPT / add_audio

Function add_audio

app.py:198–213  ·  view source on GitHub ↗
(history, audio_path, data_stored)

Source from the content-addressed store, hash-verified

196
197
198def add_audio(history, audio_path, data_stored):
199 audio, sampling_rate = librosa.load(audio_path, sr=16000)
200 input_features = audio_processor(
201 audio, sampling_rate, return_tensors="pt"
202 ).input_features # whisper training sampling rate, do not modify
203 input_features = torch.Tensor(input_features).to(device)
204 predicted_ids = audio_model.generate(input_features,
205 forced_decoder_ids=forced_decoder_ids)
206 text_input = audio_processor.batch_decode(predicted_ids,
207 skip_special_tokens=True)
208 text_input = str(text_input).strip('[]"')
209 data_stored = data_stored + [{'user_input': text_input}]
210 gr.update(value=data_stored, interactive=False)
211 history = history + [(text_input, None)]
212
213 return history, data_stored
214
215
216def add_file(history, file, txt, motion_uploaded):

Callers

nothing calls this directly

Calls 2

toMethod · 0.45
updateMethod · 0.45

Tested by

no test coverage detected