Spaces:
Runtime error
Runtime error
Update app.py
Browse files138 unmodified lines139140141142143144145146147148149215 unmodified lines36536636736836937037144 unmodified lines416417418419420421422138 unmodified linesapi_name="/run" # API name)# Check if result contains files and select the first oneif isinstance(result, list) and len(result) > 1:# Select the first audio file from the resultoriginal_audio_file = result[1] # Assuming the first element is the audio file# Iterate over the result to find the last text itemtranslated_text = ""for item in result:215 unmodified linesmarkdown_output = ""image_text = ""translated_text = ""audio_file_path = ""audio_output = ""# Debugging print statementprint(f"Image Input Type: {type(image_input)}, Audio Input Type: {type(audio_input)}")44 unmodified lines# Convert translated text to speech and get both audio file and texttarget_language = "English" # Set the target language for the speechaudio_file_path, translated_text = convert_text_to_speech(final_response, target_language, input_language)# Evaluate hallucinationhallucination_label = evaluate_hallucination(final_response, summary)138 unmodified lines139140141142143144145146147148149150151152153154155156157158159160161162163164165166167215 unmodified lines38338438538638738844 unmodified lines433434435436437438439138 unmodified linesapi_name="/run" # API name)# Check if result contains filesif isinstance(result, list) and len(result) > 1:downloaded_files = []for file_path in result[1:]:if os.path.isfile(file_path):# Download the filedownloaded_files.append(file_path)else:print(f"Path is not a file: {file_path}")if downloaded_files:# Process only the first fileoriginal_audio_file = downloaded_files[0]new_file_name = f"audio_output_{uuid.uuid4()}.wav"new_file_path = os.path.join(os.path.dirname(original_audio_file), new_file_name)os.rename(original_audio_file, new_file_path)return new_file_pathelse:return "No valid audio files were downloaded."else:return "No audio files received from the API."# Iterate over the result to find the last text itemtranslated_text = ""for item in result:215 unmodified linesmarkdown_output = ""image_text = ""translated_text = ""audio_output = ""# Debugging print statementprint(f"Image Input Type: {type(image_input)}, Audio Input Type: {type(audio_input)}")44 unmodified lines# Convert translated text to speech and get both audio file and texttarget_language = "English" # Set the target language for the speechaudio_output, translated_text = convert_text_to_speech(final_response, target_language, input_language)# Evaluate hallucinationhallucination_label = evaluate_hallucination(final_response, summary)
app.py+22-5