Skip to content

Commit

Permalink
Merge pull request #238 from NexaAI/david/bugfix
Browse files Browse the repository at this point in the history
add decode utf-8 logic in terminal output
  • Loading branch information
zhiyuan8 authored Nov 12, 2024
2 parents 74f33bd + 1423a3f commit 984aaaf
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions nexa/gguf/nexa_inference_audio_lm.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ 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)
print(response)
print(f"{response}")

except KeyboardInterrupt:
print("\nExiting...")
Expand Down Expand Up @@ -200,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:
Expand Down
2 changes: 1 addition & 1 deletion nexa/gguf/streamlit/streamlit_audio_lm.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}")
Expand Down

0 comments on commit 984aaaf

Please sign in to comment.