diff --git a/electron/main/index.html b/electron/main/index.html index 0d9587f..6a8c9f2 100644 --- a/electron/main/index.html +++ b/electron/main/index.html @@ -1,255 +1,340 @@ - + + + + + Video to document + + + - - - - Video to document - - - + +
+
+
-

Video to document

+

Video to document

-
- -
- -
- -
-
1. Step
-
2. Step
-
3. Step
-
4. Step
-
5. Step
-
6. Step
-
- -
- - - -
- - - - - -
-

Upload your video here:

-
-

Drag and drop video file

- -
No video chosen
-
- -
- - -
-
- - - - - - - - - - - - - - - - - - +
+
1. Step
+
2. Step
+
3. Step
+
4. Step
+
5. Step
+
6. Step
+
-
- - - - - +
+ - \ No newline at end of file + +
+ + + + +
+

Upload your video here:

+
+

Drag and drop video file

+ +
No video chosen
+
+ +
+ + +
+
+ + + + + + + + + + + + + + + + + +
+ + +
+ + + + + + diff --git a/electron/main/script.js b/electron/main/script.js index aaeda57..f4d2794 100644 --- a/electron/main/script.js +++ b/electron/main/script.js @@ -432,19 +432,30 @@ function setSpeakerAudiosValue(valy) { //Function to rewrite the speaker name in the json function rewriteSpeakerName() { try { - var tempy = document.getElementById("cur_speaker").value; - speakerAudios[tempy].name = document.getElementById("newSpeaker").value; - loadSpeakerOptions(speakerAudios); + const select = document.getElementById("cur_speaker"); + const newName = document.getElementById("newSpeaker").value.trim(); + + if (!newName) { + alert("Please enter a new speaker name"); + return; + } + + const selectedIndex = select.selectedIndex; + const selectedValue = select.value; + + // Update speakerAudios data + speakerAudios[selectedValue].name = newName; + + // Update the specific option text and keep value + select.options[selectedIndex].text = newName; + select.options[selectedIndex].value = selectedValue; + + // Keep it selected + select.selectedIndex = selectedIndex; + + console.log("Speaker renamed:", newName); } catch (error) { - console.log("\n\n\n" + error + "\n\n\n") - } -} -//Function to send the json with the given names back to the program to rewrite the document file -function sendSpeakerPackages() { - try { - window.submitSpeaker.speaker_submit(speakerAudios); - } catch (error) { - console.log(error); + console.log("Error renaming speaker:", error); } } @@ -488,4 +499,14 @@ function reloadDocuments() { existingDocs.appendChild(option); }); }); -} \ No newline at end of file +} + +function sendSpeakerPackages() { + try { + window.submitSpeaker.speaker_submit(speakerAudios); + } catch (error) { + console.log(error); + } +} + +window.sendSpeakerPackages = sendSpeakerPackages; \ No newline at end of file diff --git a/main.js b/main.js index cebd6b1..13cb161 100644 --- a/main.js +++ b/main.js @@ -316,16 +316,6 @@ electron.ipcMain.on("file_download", async (event) => { } }); -electron.ipcMain.on("file_download", async () => { - await mapFunctions - .get("htmlDocumentConverter") - .convert({ - inputPath: globalFinalHtmlPath, - format: globalArgs.document.outputType, - showDialog: true, - }); -}); - electron.ipcMain.on("speaker_submit", async (event, args) => { console.log("\n\n\nJa also hier kam was an \n\n\n"); console.log(args); diff --git a/services/modules/transcription-local/parakeet.js b/services/modules/transcription-local/parakeet.js deleted file mode 100644 index 10c95e0..0000000 --- a/services/modules/transcription-local/parakeet.js +++ /dev/null @@ -1,54 +0,0 @@ -// ----------------------------------------------------------- -// Parakeet (Step 3A: spawn Python minimal integration) -// ----------------------------------------------------------- - -const fs = require("fs"); -const path = require("path"); -const { spawn } = require("child_process"); - -module.exports = { - name: "parakeet", - type: "transcription", - displayname: "NVIDIA Parakeet", - - async function(audioFilePath) { - console.log("🦜 [Parakeet] Starting test integration (spawn only)..."); - console.log("🦜 Input audio:", audioFilePath); - - // Check audio exists - if (!fs.existsSync(audioFilePath)) { - throw new Error("Audio file does not exist: " + audioFilePath); - } - - // Output path in storage/transcripts - const sessionId = path.basename(audioFilePath).replace(/\.[^.]+$/, ""); - const outputDir = path.join(__dirname, "../../../storage/transcripts"); - fs.mkdirSync(outputDir, { recursive: true }); - - const outputPath = path.join(outputDir, `${sessionId}.json`); - - // ------------------------------------------------------- - // SPAWN PYTHON SCRIPT (step 3A — dummy script) - // ------------------------------------------------------- - return new Promise((resolve, reject) => { - const python310 = "C:\\Users\\smith\\AppData\\Local\\Programs\\Python\\Python310\\python.exe"; - const py = spawn(python310, [ - path.join(__dirname, "parakeet_transcribe.py"), - audioFilePath, - outputPath - ]); - - py.stdout.on("data", data => console.log("🦜 [Python]", data.toString().trim())); - py.stderr.on("data", data => console.error("🦜 [Python ERR]", data.toString().trim())); - - py.on("close", code => { - if (code === 0) { - console.log("🦜 [Parakeet] Done (spawn test). Output:", outputPath); - resolve(outputPath); - } else { - reject(new Error("Python script failed with exit code " + code)); - } - }); - }); - } -}; diff --git a/services/modules/transcription-local/parakeet_transcribe.py b/services/modules/transcription-local/parakeet_transcribe.py deleted file mode 100644 index 1272e46..0000000 --- a/services/modules/transcription-local/parakeet_transcribe.py +++ /dev/null @@ -1,71 +0,0 @@ -# ----------------------------------------------------------- -# Parakeet Real Transcriber (NVIDIA NeMo + PyTorch GPU) -# ----------------------------------------------------------- - -import sys -import json -import soundfile as sf -import torch -from nemo.collections.asr.models import ASRModel - -# Args: -# sys.argv[1] = input audio path -# sys.argv[2] = output JSON path - -audio_path = sys.argv[1] -output_path = sys.argv[2] - -print("🔥 Starting Parakeet model...") -device = "cuda" if torch.cuda.is_available() else "cpu" -print("🔥 Using device:", device) - -# ----------------------------------------------------------- -# Load Parakeet model (NVIDIA pretrained ASR) -# ----------------------------------------------------------- -model = ASRModel.from_pretrained(model_name="nvidia/parakeet-ctc-0.6b") -model = model.to(device) -model.eval() - -# ----------------------------------------------------------- -# Load audio -# ----------------------------------------------------------- -print("🎧 Loading audio:", audio_path) -audio, sr = sf.read(audio_path) - -# model expects mono float32 -if len(audio.shape) > 1: - audio = audio.mean(axis=1) - -audio = audio.astype("float32") - -# ----------------------------------------------------------- -# Run inference -# ----------------------------------------------------------- -print("🧠 Running inference...") -with torch.no_grad(): - hyp = model.transcribe([audio])[0] - -# Extract only the text -if hasattr(hyp, "text"): - transcript = hyp.text -else: - # fallback: convert to string (rare) - transcript = str(hyp) - -print("📄 Transcript:", transcript) - -# ----------------------------------------------------------- -# Save JSON format compatible with V2D pipeline -# ----------------------------------------------------------- -result = { - "id": output_path.split("/")[-1].replace(".json", ""), - "tool": "nemo_parakeet", - "status": "completed", - "text": transcript, - "words": [] # Parakeet XS doesn’t return word timestamps -} - -with open(output_path, "w", encoding="utf-8") as f: - json.dump(result, f, indent=2, ensure_ascii=False) - -print("✔ JSON saved at:", output_path)