Skip to content

Commit

Permalink
feat: Refactor file handling for audio transcriptions
Browse files Browse the repository at this point in the history
- Add newline character in print statement for better readability
- Update variable name from output_file to output_folder for clarity
  • Loading branch information
johnnyhuy committed Apr 9, 2024
1 parent 827d9de commit eec6cc9
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions transcribe_me/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ def main():

try:
if not os.path.exists(output_file):
print(f"{Fore.BLUE}Transcribing audio file: {file_path}")
print(f"{Fore.BLUE}Transcribing audio file: {file_path}\n")
transcribe_audio(file_path, output_file)
files_transcribed = True
continue
Expand All @@ -332,7 +332,7 @@ def main():
for file in glob(f"{file_path.partition('.')[0]}_part*.mp3"):
os.remove(file)

for filename in os.listdir(output_file):
for filename in os.listdir(output_folder):
output_file = os.path.join(output_folder, f"{transcription_name}.txt")
openai_models = config["openai"]["models"]
anthropic_models = config["anthropic"]["models"]
Expand All @@ -349,7 +349,7 @@ def main():
if os.path.exists(openai_summary_file):
continue

print(f"{Fore.BLUE}Summarizing {transcription_name} with OpenAI (Temp {model_config['temperature']} - {model_config['model']}):")
print(f"{Fore.BLUE}Summarizing {transcription_name} with OpenAI (Temp {model_config['temperature']} - {model_config['model']}):\n")
openai_summary = generate_summary(transcription, "openai", model_config)
print(openai_summary + "\n")

Expand All @@ -371,7 +371,7 @@ def main():
if os.path.exists(anthropic_summary_file):
continue

print(f"{Fore.BLUE}Summarizing {transcription_name} with Anthropic (Temp {model_config['temperature']} - {model_config['model']}):")
print(f"{Fore.BLUE}Summarizing {transcription_name} with Anthropic (Temp {model_config['temperature']} - {model_config['model']}):\n")
anthropic_summary = generate_summary(transcription, "anthropic", model_config)
print(openai_summary + "\n")

Expand Down

0 comments on commit eec6cc9

Please sign in to comment.