GavinHuang commited on
Commit
31b10c8
·
1 Parent(s): 4be17d8

fix: streamline transcription process by removing NumPy 2.0 compatibility handling

Browse files
Files changed (1) hide show
  1. app.py +2 -21
app.py CHANGED
@@ -55,27 +55,8 @@ def transcribe(audio, state=""):
55
  sf.write(temp_file, audio_data, samplerate=16000)
56
  print(f"Processing temporary audio file: {temp_file}")
57
 
58
- # Handling NumPy 2.0 compatibility issue
59
- try:
60
- transcription = model.transcribe([temp_file])[0]
61
- print(type(transcription))
62
- except AttributeError as e:
63
- if "np.sctypes" in str(e):
64
- print("Handling NumPy 2.0 compatibility issue")
65
- # Using a workaround to handle the np.sctypes removal
66
- import numpy as np
67
- # Create a temporary sctypes attribute if needed by older code
68
- if not hasattr(np, 'sctypes'):
69
- np.sctypes = {
70
- 'int': [np.int8, np.int16, np.int32, np.int64],
71
- 'uint': [np.uint8, np.uint16, np.uint32, np.uint64],
72
- 'float': [np.float16, np.float32, np.float64],
73
- 'complex': [np.complex64, np.complex128]
74
- }
75
- # Try again
76
- transcription = model.transcribe([temp_file])[0]
77
- else:
78
- raise
79
 
80
  os.remove(temp_file) # Clean up
81
  print("Temporary file removed.")
 
55
  sf.write(temp_file, audio_data, samplerate=16000)
56
  print(f"Processing temporary audio file: {temp_file}")
57
 
58
+ transcription = model.transcribe([temp_file])[0]
59
+ print(type(transcription))
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
60
 
61
  os.remove(temp_file) # Clean up
62
  print("Temporary file removed.")