From 1423a3fa8805e17cafb0dd8480b3fd9f8fa58c80 Mon Sep 17 00:00:00 2001 From: Yicheng Qian Date: Tue, 12 Nov 2024 11:27:59 -0800 Subject: [PATCH] update --- nexa/gguf/nexa_inference_audio_lm.py | 3 +-- nexa/gguf/streamlit/streamlit_audio_lm.py | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/nexa/gguf/nexa_inference_audio_lm.py b/nexa/gguf/nexa_inference_audio_lm.py index 05972ed9..f93153fc 100644 --- a/nexa/gguf/nexa_inference_audio_lm.py +++ b/nexa/gguf/nexa_inference_audio_lm.py @@ -153,7 +153,6 @@ def run(self): user_input = nexa_prompt("Enter text (leave empty if no prompt): ") with suppress_stdout_stderr(): response = self.inference(audio_path, user_input) - response = response.decode("utf-8") if isinstance(response, bytes) else response print(f"{response}") except KeyboardInterrupt: @@ -201,7 +200,7 @@ def inference(self, audio_path: str, prompt: str = "") -> str: response = audio_lm_cpp.process_full( self.context, ctypes.byref(self.ctx_params), is_qwen=self.is_qwen ) - return response + return response.decode("utf-8") if isinstance(response, bytes) else response except Exception as e: raise RuntimeError(f"Error during inference: {str(e)}") finally: diff --git a/nexa/gguf/streamlit/streamlit_audio_lm.py b/nexa/gguf/streamlit/streamlit_audio_lm.py index e7df118f..648e1a89 100644 --- a/nexa/gguf/streamlit/streamlit_audio_lm.py +++ b/nexa/gguf/streamlit/streamlit_audio_lm.py @@ -46,7 +46,7 @@ def process_audio(nexa_model, audio_file, prompt=""): try: # Use the model's inference method directly response = nexa_model.inference(temp_audio_path, prompt) - return response.decode("utf-8") if isinstance(response, bytes) else response + return response except Exception as e: st.error(f"Error during audio processing: {e}")