+
Audio Transcription
+
+
Upload or Record Audio
+ {/* File Upload */}
+
+
+
+
+ {/* Recording Controls */}
+
+
Record Audio
+ {!recording ? (
+
+ ) : (
+
+ )}
+
+
+ {/* Transcription Result */}
+
+
Transcription:
+ {loading ? (
+
Processing transcription...
+ ) : transcription ? (
+
{transcription}
+ ) : (
+
No transcription available yet.
+ )}
+
+
+ );
};
export default AudioTranscriber;
diff --git a/src/app/api/transcribe/__pycache__/app.cpython-39.pyc b/src/app/api/transcribe/__pycache__/app.cpython-39.pyc
index 423ad4b..9002252 100644
Binary files a/src/app/api/transcribe/__pycache__/app.cpython-39.pyc and b/src/app/api/transcribe/__pycache__/app.cpython-39.pyc differ
diff --git a/src/app/api/transcribe/app.py b/src/app/api/transcribe/app.py
index 12f6408..d039ad1 100644
--- a/src/app/api/transcribe/app.py
+++ b/src/app/api/transcribe/app.py
@@ -24,9 +24,8 @@ async def transcribe_audio(file: UploadFile = File(...)):
try:
# Transcribe the audio
- result = model.transcribe("inputs/test.mp3")
+ result = model.transcribe(temp_path)
transcription = result["text"]
- print(transcription)
finally:
# Clean up temporary file
os.remove(temp_path)
diff --git a/src/app/api/transcribe/route.ts b/src/app/api/transcribe/route.ts
deleted file mode 100644
index ce4efac..0000000
--- a/src/app/api/transcribe/route.ts
+++ /dev/null
@@ -1,55 +0,0 @@
-import { NextRequest, NextResponse } from "next/server";
-import multer from "multer";
-import fs from "fs/promises";
-import whisper from "openai-whisper";
-
-const upload = multer({ dest: "uploads/" });
-
-export const config = {
- api: {
- bodyParser: false, // Disable Next.js's body parsing for file uploads
- },
-};
-
-// Whisper model (initialize once for efficiency)
-const model = whisper.load_model("base");
-
-// Utility to transcribe audio
-async function transcribeAudio(filePath: string): Promise