Skip to content

Commit

Permalink
run lint
Browse files Browse the repository at this point in the history
  • Loading branch information
Luisotee committed Dec 1, 2024
1 parent 61c8a12 commit 6214aa3
Showing 1 changed file with 17 additions and 16 deletions.
33 changes: 17 additions & 16 deletions apps/ai_api/eda_ai_api/api/routes/classifier.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,23 +176,24 @@ async def classifier_route(
) -> ClassifierResponse:
"""Main route handler for classifier API"""
try:
# Check if audio is provided and not empty
audio_content = await audio.read() if audio else None
has_valid_audio = audio_content and len(audio_content) > 0

# Reset file pointer if audio will be used
if has_valid_audio:
await audio.seek(0)

combined_parts = []

# Process audio if valid
if has_valid_audio:
transcription = await process_audio(audio)
print("==================================================")
print(f" TRANSCRIPTION: {transcription}")
print("==================================================")
combined_parts.append(f'Transcription of attached audio: "{transcription}"')
has_valid_audio = False

# Process audio if provided
if audio is not None:
# Check if audio is not empty
audio_content = await audio.read()
has_valid_audio = len(audio_content) > 0

if has_valid_audio:
await audio.seek(0)
transcription = await process_audio(audio)
print("==================================================")
print(f" TRANSCRIPTION: {transcription}")
print("==================================================")
combined_parts.append(
f'Transcription of attached audio: "{transcription}"'
)

# Add message if provided
if message:
Expand Down

0 comments on commit 6214aa3

Please sign in to comment.