Describe the bug
Code:
classifier = EncoderClassifier.from_hparams(
source="Jzuluaga/accent-id-commonaccent_ecapa",
savedir="pretrained/accent")
def detect_accent(audio_bytes: bytes):
try:
with tempfile.NamedTemporaryFile(suffix=".wav", delete=True) as temp:
temp.write(audio_bytes)
temp.flush()
temp_path = temp.name
print(temp_path,flush=True)
if not os.path.exists(temp_path):
print(f"Temp path does not exist: {temp_path}")
out_prob, score, idx, label = classifier.classify_file(temp_path)
return label, score.item()
except Exception as e:
print(f"Accent detection failed: {e}")
I have been working with classify_file and it's showing double path while processing temp_path but I have checked the output of print(temp_path,flush=True). It's showing single path to .wav file.
I am using PyCharm 2025.1.1.1 and python 3.12. Basically it takes my_project_path + path_of_.wav
Am I missing something?
Expected behaviour
It should only take the path of the .wav file
To Reproduce
No response
Environment Details
No response
Relevant Log Output
Additional Context
No response
Describe the bug
Code:
classifier = EncoderClassifier.from_hparams(
source="Jzuluaga/accent-id-commonaccent_ecapa",
savedir="pretrained/accent")
def detect_accent(audio_bytes: bytes):
try:
with tempfile.NamedTemporaryFile(suffix=".wav", delete=True) as temp:
temp.write(audio_bytes)
temp.flush()
temp_path = temp.name
print(temp_path,flush=True)
if not os.path.exists(temp_path):
print(f"Temp path does not exist: {temp_path}")
out_prob, score, idx, label = classifier.classify_file(temp_path)
return label, score.item()
except Exception as e:
print(f"Accent detection failed: {e}")
I have been working with classify_file and it's showing double path while processing temp_path but I have checked the output of print(temp_path,flush=True). It's showing single path to .wav file.
I am using PyCharm 2025.1.1.1 and python 3.12. Basically it takes my_project_path + path_of_.wav
Am I missing something?
Expected behaviour
It should only take the path of the .wav file
To Reproduce
No response
Environment Details
No response
Relevant Log Output
Additional Context
No response