Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -4,8 +4,8 @@ import whisper
|
|
| 4 |
# 1. Load the model into memory (Runs once on startup)
|
| 5 |
# "base" is a good balance of speed and accuracy for a free CPU
|
| 6 |
print("Loading Whisper model...")
|
| 7 |
-
|
| 8 |
-
|
| 9 |
# 2. Define the inference function
|
| 10 |
def transcribe_audio(audio_filepath):
|
| 11 |
print(f"Processing audio: {audio_filepath}")
|
|
@@ -14,7 +14,8 @@ def transcribe_audio(audio_filepath):
|
|
| 14 |
result = model.transcribe(
|
| 15 |
audio_filepath,
|
| 16 |
language="ar",
|
| 17 |
-
word_timestamps=True
|
|
|
|
| 18 |
)
|
| 19 |
|
| 20 |
# Return a clean dictionary
|
|
|
|
| 4 |
# 1. Load the model into memory (Runs once on startup)
|
| 5 |
# "base" is a good balance of speed and accuracy for a free CPU
|
| 6 |
print("Loading Whisper model...")
|
| 7 |
+
# Change "base" to "small"
|
| 8 |
+
model = whisper.load_model("medium")
|
| 9 |
# 2. Define the inference function
|
| 10 |
def transcribe_audio(audio_filepath):
|
| 11 |
print(f"Processing audio: {audio_filepath}")
|
|
|
|
| 14 |
result = model.transcribe(
|
| 15 |
audio_filepath,
|
| 16 |
language="ar",
|
| 17 |
+
word_timestamps=True,
|
| 18 |
+
condition_on_previous_text=False # ADD THIS LINE
|
| 19 |
)
|
| 20 |
|
| 21 |
# Return a clean dictionary
|