Skip to content

Commit

Permalink
fix: added missing env example
Browse files Browse the repository at this point in the history
  • Loading branch information
zhiyan114 committed Oct 12, 2023
1 parent cc8a92c commit 015b3fb
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 2 additions & 0 deletions extra/whisper/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
# `AMQP_VHOST` - The vhost of the AMQP server
# `AMQP_TLS` - Whether to use TLS for the AMQP server
# `SENTRY_DSN` - Your Sentry DSN
# `IS_PREMIUM` - True/False, whether to use the large model or not

AMQP_HOST=""
AMQP_PORT="5672"
Expand All @@ -13,3 +14,4 @@ AMQP_PASS=""
AMQP_VHOST=""
AMQP_TLS="false"
SENTRY_DSN=""
IS_PREMIUM=""
3 changes: 1 addition & 2 deletions extra/whisper/inference.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
import os
import whisper
# tiny, base, small, medium, and large are the available options. For nVidia Tegra X1 chips, use the small model.

isPremiumProcessing = os.environ.get("IS_PREMIUM", "false").lower() == "true"
model = "large-v2" if isPremiumProcessing else "base"

model = whisper.load_model(model)
print("Inference running on "+str(model.device))

def convert(fileName: str, lang: str = None, prompt: str = None):
#, task="translate" & "transcribe"
# task="translate" & "transcribe"
return model.transcribe(fileName, language=lang, initial_prompt=prompt)

0 comments on commit 015b3fb

Please sign in to comment.