Update subgen.py
Fixed some formatting.
This commit is contained in:
@@ -7,7 +7,7 @@ import pathlib
|
|||||||
import webhook_listener
|
import webhook_listener
|
||||||
import subprocess
|
import subprocess
|
||||||
|
|
||||||
# parse our arguments from the Dockerfile
|
# parse our arguments from environment variables
|
||||||
whisper_model = os.getenv('WHISPER_MODEL') or "medium"
|
whisper_model = os.getenv('WHISPER_MODEL') or "medium"
|
||||||
whisper_speedup = bool(os.getenv('WHISPER_SPEEDUP'))
|
whisper_speedup = bool(os.getenv('WHISPER_SPEEDUP'))
|
||||||
whisper_threads = os.getenv('WHISPER_THREADS') or "4"
|
whisper_threads = os.getenv('WHISPER_THREADS') or "4"
|
||||||
@@ -48,7 +48,6 @@ def process_post_request(request, *args, **kwargs):
|
|||||||
if ((procaddedmedia and event == "added") or (procmediaonplay and event == "played")) and (len(glob.glob("{}/{}*subgen*".format(filepath, filenamenoextension))) == 0) and not os.path.isfile("{}.output.wav".format(fullpath)) and not file_has_internal_sub: #glob nonsense checks if there exists a subgen file already and won't make a new one
|
if ((procaddedmedia and event == "added") or (procmediaonplay and event == "played")) and (len(glob.glob("{}/{}*subgen*".format(filepath, filenamenoextension))) == 0) and not os.path.isfile("{}.output.wav".format(fullpath)) and not file_has_internal_sub: #glob nonsense checks if there exists a subgen file already and won't make a new one
|
||||||
if whisper_speedup:
|
if whisper_speedup:
|
||||||
print("This is a speedup run!")
|
print("This is a speedup run!")
|
||||||
print(os.getenv('WHISPER_SPEEDUP'))
|
|
||||||
finalsubname = "{0}/{1}.subgen.{2}.speedup.{3}".format(
|
finalsubname = "{0}/{1}.subgen.{2}.speedup.{3}".format(
|
||||||
filepath, filenamenoextension, whisper_model, namesublang)
|
filepath, filenamenoextension, whisper_model, namesublang)
|
||||||
else:
|
else:
|
||||||
@@ -95,7 +94,7 @@ subprocess.call("git clone https://github.com/ggerganov/whisper.cpp .", shell=Tr
|
|||||||
if updaterepo:
|
if updaterepo:
|
||||||
print("Updating repo!")
|
print("Updating repo!")
|
||||||
subprocess.call("git pull", shell=True)
|
subprocess.call("git pull", shell=True)
|
||||||
if os.path.isfile("/whisper.cpp/samples/jfk.wav"):
|
if os.path.isfile("/whisper.cpp/samples/jfk.wav"): # delete the sample file, so it doesn't try transcribing it. Saves us a couple seconds.
|
||||||
print("Deleting sample file")
|
print("Deleting sample file")
|
||||||
os.remove("/whisper.cpp/samples/jfk.wav")
|
os.remove("/whisper.cpp/samples/jfk.wav")
|
||||||
subprocess.call("make " + whisper_model, shell=True)
|
subprocess.call("make " + whisper_model, shell=True)
|
||||||
|
|||||||
Reference in New Issue
Block a user