Spaces:
Runtime error
Runtime error
neuralleap
commited on
Commit
•
ea2af5a
1
Parent(s):
7ea637e
Update main.py
Browse files
main.py
CHANGED
@@ -4,7 +4,7 @@ import os
|
|
4 |
import io
|
5 |
|
6 |
from faster_whisper import WhisperModel
|
7 |
-
model_size = "large-
|
8 |
transcripe_model = WhisperModel(model_size, device="cuda", compute_type="float16")
|
9 |
|
10 |
|
@@ -15,7 +15,7 @@ app = FastAPI()
|
|
15 |
async def create_upload_file(file: UploadFile = File(...)):
|
16 |
try:
|
17 |
# Save the file with a specific name
|
18 |
-
|
19 |
|
20 |
with open(file_path, "wb") as f:
|
21 |
f.write(file.file.read())
|
@@ -23,7 +23,7 @@ async def create_upload_file(file: UploadFile = File(...)):
|
|
23 |
# Read the content of the saved file
|
24 |
#with open(file_path, "rb") as f:
|
25 |
#file_content = f.read()
|
26 |
-
segments, info = transcripe_model.transcribe(
|
27 |
|
28 |
print("Detected language '%s' with probability %f" % (info.language, info.language_probability))
|
29 |
result = ""
|
|
|
4 |
import io
|
5 |
|
6 |
from faster_whisper import WhisperModel
|
7 |
+
model_size = "large-v3"
|
8 |
transcripe_model = WhisperModel(model_size, device="cuda", compute_type="float16")
|
9 |
|
10 |
|
|
|
15 |
async def create_upload_file(file: UploadFile = File(...)):
|
16 |
try:
|
17 |
# Save the file with a specific name
|
18 |
+
file_path = "inputvoice.mp3"
|
19 |
|
20 |
with open(file_path, "wb") as f:
|
21 |
f.write(file.file.read())
|
|
|
23 |
# Read the content of the saved file
|
24 |
#with open(file_path, "rb") as f:
|
25 |
#file_content = f.read()
|
26 |
+
segments, info = transcripe_model.transcribe(file_path, beam_size=5)
|
27 |
|
28 |
print("Detected language '%s' with probability %f" % (info.language, info.language_probability))
|
29 |
result = ""
|