Spaces:
Running
Running
Update src/video_processing.py
Browse files- src/video_processing.py +27 -0
src/video_processing.py
CHANGED
@@ -137,3 +137,30 @@ def process_youtube_video(youtube_url, audio_format, elevenlabs_api_key, model_i
|
|
137 |
error_message = f"Error processing YouTube video: {str(e)}"
|
138 |
return None, error_message, None, error_message, error_message, None, None
|
139 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
137 |
error_message = f"Error processing YouTube video: {str(e)}"
|
138 |
return None, error_message, None, error_message, error_message, None, None
|
139 |
|
140 |
+
|
141 |
+
def process_audio_document(audio_path, elevenlabs_api_key, model_id, gemini_api_key, language, content_type):
|
142 |
+
try:
|
143 |
+
# Transcribe the audio
|
144 |
+
transcription, transcript_path, transcription_status = transcribe_audio(
|
145 |
+
audio_path,
|
146 |
+
elevenlabs_api_key,
|
147 |
+
model_id
|
148 |
+
)
|
149 |
+
|
150 |
+
if not transcription:
|
151 |
+
return "Transcription failed", None, None, None, None
|
152 |
+
|
153 |
+
# Generate summary or quiz from transcription
|
154 |
+
formatted_output, json_path, txt_path = analyze_document(
|
155 |
+
transcription,
|
156 |
+
gemini_api_key,
|
157 |
+
language,
|
158 |
+
content_type
|
159 |
+
)
|
160 |
+
|
161 |
+
return "Processing completed successfully", transcript_path, formatted_output, txt_path, json_path
|
162 |
+
except Exception as e:
|
163 |
+
error_message = f"Error processing audio: {str(e)}"
|
164 |
+
return error_message, None, error_message, None, None
|
165 |
+
|
166 |
+
|