Skip to content

Commit

Permalink
Update subgen.py
Browse files Browse the repository at this point in the history
More housekeeping
  • Loading branch information
McCloudS authored Oct 29, 2023
1 parent 6850829 commit a47cd33
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions subgen/subgen.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,9 @@ def convert_to_bool(in_bool):
app = FastAPI()
model = None
files_to_transcribe = []
subextension = f".subgen.{whisper_model}.{namesublang}.srt"
print("Transcriptions are limited to running " + str(concurrent_transcriptions) + " at a time")
print("Running " + str(whisper_threads) + " threads per transcription")
subextension = f".subgen.{whisper_model.split('.')[0]}.{namesublang}.srt"
print(f"Transcriptions are limited to running {str(concurrent_transcriptions)} at a time")
print(f"Running {str(whisper_threads)} threads per transcription")

if debug:
logging.basicConfig(stream=sys.stderr, level=logging.NOTSET)
Expand Down Expand Up @@ -219,7 +219,10 @@ def gen_subtitles(file_path: str, transcribe_or_translate_str: str, front=True)
finally:
if len(files_to_transcribe) == 0:
logging.debug("Queue is empty, clearing/releasing VRAM")
del model
try:
del model
except Exception as e:
None
gc.collect()

def has_subtitle_language(video_file, target_language):
Expand Down Expand Up @@ -345,4 +348,4 @@ def transcribe_existing():
print("Starting webhook!")
if __name__ == "__main__":
import uvicorn
uvicorn.run("subgen:app", host="0.0.0.0", port=int(webhookport), reload=debug)
uvicorn.run("subgen:app", host="0.0.0.0", port=int(webhookport), reload=debug, use_colors=True)

0 comments on commit a47cd33

Please sign in to comment.