Spaces:
Sleeping
Sleeping
Update transcription.py
Browse files- __pycache__/transcription.cpython-310.pyc +0 -0
- static/process.js +1 -1
- transcription.py +5 -3
__pycache__/transcription.cpython-310.pyc
CHANGED
|
Binary files a/__pycache__/transcription.cpython-310.pyc and b/__pycache__/transcription.cpython-310.pyc differ
|
|
|
static/process.js
CHANGED
|
@@ -5,7 +5,7 @@
|
|
| 5 |
let recordingInterval;
|
| 6 |
let count_voice = 0;
|
| 7 |
let before_rate = [];
|
| 8 |
-
const RECORDING_INTERVAL_MS =
|
| 9 |
// メンバーとチャートの初期化
|
| 10 |
let members = [];
|
| 11 |
let voiceData = [];
|
|
|
|
| 5 |
let recordingInterval;
|
| 6 |
let count_voice = 0;
|
| 7 |
let before_rate = [];
|
| 8 |
+
const RECORDING_INTERVAL_MS = 5000; // 5秒
|
| 9 |
// メンバーとチャートの初期化
|
| 10 |
let members = [];
|
| 11 |
let voiceData = [];
|
transcription.py
CHANGED
|
@@ -28,6 +28,7 @@ class TranscriptionMaker():
|
|
| 28 |
if not os.path.isdir(audio_directory):
|
| 29 |
raise ValueError(f"The specified path is not a valid directory: {audio_directory}")
|
| 30 |
audio_files = os.listdir(audio_directory)
|
|
|
|
| 31 |
for audio_file in audio_files:
|
| 32 |
if os.path.splitext(audio_file)[-1].lower() != '.wav':
|
| 33 |
continue
|
|
@@ -37,7 +38,8 @@ class TranscriptionMaker():
|
|
| 37 |
except Exception as e:
|
| 38 |
print(f"Error transcripting file {audio_path}: {e}")
|
| 39 |
raise
|
| 40 |
-
|
|
|
|
| 41 |
results.append({
|
| 42 |
"start": segment.start,
|
| 43 |
"end": segment.end,
|
|
@@ -102,7 +104,7 @@ class TranscriptionMaker():
|
|
| 102 |
return ''.join(random.choice(letters) for i in range(length))
|
| 103 |
|
| 104 |
def generate_filename(self,random_length):
|
| 105 |
-
random_string = self.generate_random_string(random_length)
|
| 106 |
current_time = datetime.now().strftime("%Y%m%d%H%M%S")
|
| 107 |
-
filename = f"{current_time}
|
| 108 |
return filename
|
|
|
|
| 28 |
if not os.path.isdir(audio_directory):
|
| 29 |
raise ValueError(f"The specified path is not a valid directory: {audio_directory}")
|
| 30 |
audio_files = os.listdir(audio_directory)
|
| 31 |
+
audio_files = sorted(os.listdir(audio_directory))
|
| 32 |
for audio_file in audio_files:
|
| 33 |
if os.path.splitext(audio_file)[-1].lower() != '.wav':
|
| 34 |
continue
|
|
|
|
| 38 |
except Exception as e:
|
| 39 |
print(f"Error transcripting file {audio_path}: {e}")
|
| 40 |
raise
|
| 41 |
+
sorted_segments = sorted(segments, key=lambda s: s.start)
|
| 42 |
+
for segment in sorted_segments:
|
| 43 |
results.append({
|
| 44 |
"start": segment.start,
|
| 45 |
"end": segment.end,
|
|
|
|
| 104 |
return ''.join(random.choice(letters) for i in range(length))
|
| 105 |
|
| 106 |
def generate_filename(self,random_length):
|
| 107 |
+
#random_string = self.generate_random_string(random_length)
|
| 108 |
current_time = datetime.now().strftime("%Y%m%d%H%M%S")
|
| 109 |
+
filename = f"{current_time}.wav"
|
| 110 |
return filename
|