added - execution time

This commit is contained in:
Ammar Ahmed 2025-12-08 01:47:02 +05:00
parent 0ed9df53f5
commit 93c6317a1e

View File

@ -1,5 +1,6 @@
import argparse import argparse
from helpers.audio_analysis import UrduIntentExtractor from helpers.audio_analysis import UrduIntentExtractor
import time
def main(): def main():
""" """
@ -38,11 +39,14 @@ def main():
# Initialize extractor # Initialize extractor
extractor = UrduIntentExtractor(model_size=args.model) extractor = UrduIntentExtractor(model_size=args.model)
start_time = time.time()
# Process audio file # Process audio file
results = extractor.process_audio_file( results = extractor.process_audio_file(
args.audio_file, args.audio_file,
verbose=not args.quiet verbose=not args.quiet
) )
end_time = time.time()
print(f"⏱️ Execution time: {(end_time - start_time) / 60:.2f} minutes, {(end_time - start_time)} seconds")
# Save to JSON if requested # Save to JSON if requested
if args.output: if args.output:
@ -52,6 +56,7 @@ def main():
print(f"\nResults saved to: {args.output}") print(f"\nResults saved to: {args.output}")
except FileNotFoundError as e: except FileNotFoundError as e:
print(f"⏱️ Execution time: {(end_time - start_time) / 60:.2f} minutes, {(end_time - start_time)} seconds")
print(f"❌ Error: {e}") print(f"❌ Error: {e}")
except Exception as e: except Exception as e:
print(f"❌ An error occurred: {str(e)}") print(f"❌ An error occurred: {str(e)}")