Spaces:
Sleeping
Sleeping
feat: update audio
Browse files
src/expon/presentation/application/internal/commandservices/audio_upload_service.py
CHANGED
@@ -28,16 +28,13 @@ class AudioUploadService:
|
|
28 |
def upload_and_analyze(self, file: UploadFile, user_id: UUID = UUID("00000000-0000-0000-0000-000000000000")):
|
29 |
# 1. Guardar archivo original
|
30 |
file_path = self.storage_service.save(file)
|
31 |
-
|
32 |
-
# Obtener el nombre real del archivo guardado
|
33 |
-
filename = os.path.basename(file_path)
|
34 |
-
|
35 |
# 2. Transcribir directamente con AssemblyAI
|
36 |
result = self.transcription_service.transcribe(file_path)
|
37 |
-
|
38 |
transcript = result["text"]
|
39 |
confidence = result.get("confidence", 1.0)
|
40 |
-
|
41 |
# 3. Simular metadata b谩sica (AssemblyAI no devuelve duraci贸n ni sample_rate)
|
42 |
metadata = AudioMetadata(
|
43 |
duration=0.0, # Placeholder, se puede estimar si se requiere
|
@@ -53,7 +50,7 @@ class AudioUploadService:
|
|
53 |
presentation = Presentation(
|
54 |
id=uuid4(),
|
55 |
user_id=user_id,
|
56 |
-
filename=filename,
|
57 |
transcript=transcript,
|
58 |
dominant_emotion=emotion_data["dominant_emotion"],
|
59 |
emotion_probabilities=emotion_data["emotion_probabilities"],
|
|
|
28 |
def upload_and_analyze(self, file: UploadFile, user_id: UUID = UUID("00000000-0000-0000-0000-000000000000")):
|
29 |
# 1. Guardar archivo original
|
30 |
file_path = self.storage_service.save(file)
|
31 |
+
|
|
|
|
|
|
|
32 |
# 2. Transcribir directamente con AssemblyAI
|
33 |
result = self.transcription_service.transcribe(file_path)
|
34 |
+
|
35 |
transcript = result["text"]
|
36 |
confidence = result.get("confidence", 1.0)
|
37 |
+
|
38 |
# 3. Simular metadata b谩sica (AssemblyAI no devuelve duraci贸n ni sample_rate)
|
39 |
metadata = AudioMetadata(
|
40 |
duration=0.0, # Placeholder, se puede estimar si se requiere
|
|
|
50 |
presentation = Presentation(
|
51 |
id=uuid4(),
|
52 |
user_id=user_id,
|
53 |
+
filename=file.filename,
|
54 |
transcript=transcript,
|
55 |
dominant_emotion=emotion_data["dominant_emotion"],
|
56 |
emotion_probabilities=emotion_data["emotion_probabilities"],
|