puzshsahc usah
This commit is contained in:
Ali
2024-12-10 20:48:27 +01:00
parent 6b02a86b46
commit 42325cb600
2 changed files with 12 additions and 3 deletions
+11 -2
View File
@@ -1,4 +1,4 @@
import os, pymupdf
import os, pymupdf, whisper, json
def read_files(path, output, filetypes=None):
if filetypes is None:
@@ -19,4 +19,13 @@ def extract_pdf_content(pdf_datei):
a = ""
for page in doc:
a += page.get_text()
return a
return a
def extract_mp3_content(mp3_datei):
model = whisper.load_model('tiny')
result = model.transcribe(str(mp3_datei), language='de', verbose=True)
with open('transcript.json', "w") as f:
json.dump(result['text'], f, indent=4)
+1 -1
View File
@@ -9,7 +9,7 @@ def retrieve_file_contents(path):
"jpg": lambda path: "",
"png": lambda path: "",
"txt": lambda path: lib.extract_pdf_content(path),
"mp3": lambda path: "test mp3"
"mp3": lambda path: lib.extract_mp3_content(path),
}
lib.read_files(path, files := [])