From c33c0f1f5369038bc47eab5c5cb13995fb9d4592 Mon Sep 17 00:00:00 2001 From: Jaikinator Date: Fri, 26 Jan 2024 15:09:11 +0100 Subject: [PATCH] add app file and add gitignore --- .dockerignore | 6 ++++ .gitignore | 6 ++++ scraibe/app/app.py | 72 ++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 84 insertions(+) create mode 100644 .dockerignore create mode 100644 .gitignore create mode 100644 scraibe/app/app.py diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..1155cba --- /dev/null +++ b/.dockerignore @@ -0,0 +1,6 @@ +scraibe/*__pycache__ +scraibe/app/*__pycache__ +scraibe/.pyannotetoken +.git +.gitignore +.github diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..18c7986 --- /dev/null +++ b/.gitignore @@ -0,0 +1,6 @@ +transcibe.py +scraibe/*__pycache__ +scraibe/app/*__pycache__ +scraibe/.pyannotetoken + + diff --git a/scraibe/app/app.py b/scraibe/app/app.py new file mode 100644 index 0000000..798e2be --- /dev/null +++ b/scraibe/app/app.py @@ -0,0 +1,72 @@ +""" +Gradio App. +-------------------------------- + +This module provides an interface to transcribe audio files using the +Scraibe model. Users can either upload an audio file or record their speech +live for transcription. The application supports multiple languages and provides +options to specify the number of speakers and the language of the audio. + +Attributes: + LANGUAGES (list): A list of supported languages for transcription. + +Usage: + Run this script to start the Gradio web interface for audio transcription. + +""" + + +#### +# Gradio Interface +#### + +from threading import Thread + +import scraibe.app.global_var as gv +from .interface import gradio_Interface +from .multi import * +from .utils import * + + +def app(config : str = None, **kwargs): + """ + Launches the Gradio interface for audio transcription. + + Args: + interface_params (dict): A dictionary of parameters for the Gradio interface. + queue_params (dict): A dictionary of parameters for the queue. + launch_params (dict): A dictionary of parameters for launching the interface. + + Returns: + None + + """ + + # Load the configuration + + config = AppConfig.load_config(config, **kwargs) + + + gv.MODEL_PROCESS = start_model_worker(gv.MODEL_PARAMS, + gv.REQUEST_QUEUE, + gv.LAST_ACTIVE_TIME, + gv.RESPONSE_QUEUE, + gv.LOADED_EVENT, + gv.RUNNING_EVENT) + + timer = Thread(target=timer_thread, args=(gv.REQUEST_QUEUE, + gv.LAST_ACTIVE_TIME, + gv.LOADED_EVENT, + gv.RUNNING_EVENT), daemon=True) + layout = config.get_layout() + + timer.start() + + print("Starting Gradio Web Interface") + + gradio_Interface(layout).queue(**config.queue).launch(**config.launch) + + timer.join() + gv.MODEL_PROCESS.join() + + print('') \ No newline at end of file