some minor fixes
This commit is contained in:
129
app.py
129
app.py
@@ -71,8 +71,15 @@ def updateButton(isChecked):
|
|||||||
def updateTextbox(isChecked):
|
def updateTextbox(isChecked):
|
||||||
return gr.update(visible=isChecked)
|
return gr.update(visible=isChecked)
|
||||||
|
|
||||||
|
###################################################
|
||||||
|
# ____ ___.___ ___. .__ #
|
||||||
|
#| | \ | \_ |__ ____ | | ______ _ __#
|
||||||
|
#| | / | | __ \_/ __ \| | / _ \ \/ \/ /#
|
||||||
|
#| | /| | | \_\ \ ___/| |_( <_> ) / #
|
||||||
|
#|______/ |___| |___ /\___ >____/\____/ \/\_/ #
|
||||||
|
# \/ \/ #
|
||||||
|
###################################################
|
||||||
|
|
||||||
# Интерфейс
|
|
||||||
with gr.Blocks() as demo:
|
with gr.Blocks() as demo:
|
||||||
gr.HTML('''
|
gr.HTML('''
|
||||||
<div align=center>
|
<div align=center>
|
||||||
@@ -83,72 +90,82 @@ with gr.Blocks() as demo:
|
|||||||
''')
|
''')
|
||||||
|
|
||||||
with gr.Row():
|
with gr.Row():
|
||||||
with gr.Column():
|
# Вкладка с основным взаимодействием
|
||||||
# Колонка в левой части экрана с основным взаимодействием
|
with gr.Tab('Actions'):
|
||||||
with gr.Accordion(label='Recognization'):
|
isPipelineEnabledCheckbox = gr.Checkbox(label='is pipeline enabled', value=True, interactive=True)
|
||||||
with gr.Column():
|
|
||||||
audioFile = gr.Audio(label='Load audio for transcribe', type="filepath")
|
|
||||||
recognizeBtn = gr.Button('recognize', variant='primary')
|
|
||||||
|
|
||||||
with gr.Accordion(label='Recognized text'):
|
with gr.Row():
|
||||||
recognizedText = gr.TextArea(label='')
|
with gr.Accordion(label='Recognization and integration'):
|
||||||
|
with gr.Column():
|
||||||
|
audioFile = gr.Audio(label='Load audio for transcribe', type="filepath")
|
||||||
|
images = gr.Files(label='Upload images', file_types=['image'])
|
||||||
|
recognizeBtn = gr.Button('recognize and integrate', variant='primary')
|
||||||
|
|
||||||
# Колонка в правой части экрана с настройками
|
with gr.Accordion(label='Recognized text'):
|
||||||
|
recognizedText = gr.TextArea(label='')
|
||||||
|
|
||||||
|
with gr.Accordion(label='LLM'):
|
||||||
|
with gr.Column():
|
||||||
|
refineTextBtn = gr.Button('refine text', variant='secondary', interactive=False)
|
||||||
|
|
||||||
|
with gr.Accordion(label='Refined text raw'):
|
||||||
|
refinedText = gr.Textbox(label='', show_copy_button=True)
|
||||||
|
|
||||||
|
with gr.Accordion(label='Refined text md formated'):
|
||||||
|
refinedTextMD = gr.Markdown(label='')
|
||||||
|
|
||||||
|
# Вкладка с настройками
|
||||||
|
with gr.Tab('Settings'):
|
||||||
with gr.Column():
|
with gr.Column():
|
||||||
with gr.Accordion(label='Settings'):
|
# Первое поле на всю ширину в акордионе настроек
|
||||||
# Первое поле на всю ширину в акордионе настроек
|
with gr.Accordion('File settings'):
|
||||||
with gr.Group():
|
saveFileCheckbox = gr.Checkbox(label='save file', value=True, interactive=True)
|
||||||
saveFileCheckbox = gr.Checkbox(label='save file', value=True, interactive=True)
|
filename = gr.Textbox(label='Output filename', value='output.txt', interactive=True)
|
||||||
filename = gr.Textbox(label='Output filename', value='output.txt', interactive=True)
|
filenamePdf = gr.Textbox(label='Output filename for pdf', value='output.pdf', interactive=True)
|
||||||
filenamePdf = gr.Textbox(label='Output filename for pdf', value='output.pdf', interactive=True)
|
|
||||||
|
|
||||||
|
# Акордион настроек faster whisper
|
||||||
|
with gr.Accordion(label='Faster whisper settings'):
|
||||||
|
with gr.Row():
|
||||||
|
# Левая колонка в акордионе
|
||||||
|
with gr.Column():
|
||||||
|
fastWhisperModel = gr.Dropdown(label='Model', choices=FAST_WHISPER_MODELS, value=FAST_WHISPER_MODELS[11], interactive=True)
|
||||||
|
|
||||||
# Акордион настроек faster whisper
|
beamSize = gr.Number(label='beam_size', value=8, interactive=True)
|
||||||
with gr.Accordion(label='Faster whisper settings'):
|
noSpeechThreshold = gr.Number(label='no_speech_threshold', value=0.5, interactive=True)
|
||||||
with gr.Row():
|
vadFilter = gr.Checkbox(label='vad_filter', value=True, interactive=True)
|
||||||
# Левая колонка в акордионе
|
wordTimestamps = gr.Checkbox(label='word_timestamps', value=True, interactive=True)
|
||||||
with gr.Column():
|
conditionOnPreviousText = gr.Checkbox(label='condition_on_previous_text', value=False, interactive=True)
|
||||||
fastWhisperModel = gr.Dropdown(label='Model', choices=FAST_WHISPER_MODELS, value=FAST_WHISPER_MODELS[11], interactive=True)
|
|
||||||
|
|
||||||
beamSize = gr.Number(label='beam_size', value=8, interactive=True)
|
# Правая колонка в акордионе
|
||||||
noSpeechThreshold = gr.Number(label='no_speech_threshold', value=0.5, interactive=True)
|
with gr.Column():
|
||||||
vadFilter = gr.Checkbox(label='vad_filter', value=True, interactive=True)
|
with gr.Accordion(label='Vad parameters'):
|
||||||
wordTimestamps = gr.Checkbox(label='word_timestamps', value=True, interactive=True)
|
minSilenceDurationMs = gr.Number(label='min_silence_duration_ms', value=300, interactive=True)
|
||||||
conditionOnPreviousText = gr.Checkbox(label='condition_on_previous_text', value=False, interactive=True)
|
speechPadMs = gr.Number(label='speech_pad_ms', value=200, interactive=True)
|
||||||
|
|
||||||
# Правая колонка в акордионе
|
with gr.Accordion(label='Temperature'):
|
||||||
with gr.Column():
|
temp0 = gr.Number(label='temp_0', value=0.0, interactive=True)
|
||||||
with gr.Accordion(label='Vad parameters'):
|
temp1 = gr.Number(label='temp_1', value=0.2, interactive=True)
|
||||||
minSilenceDurationMs = gr.Number(label='min_silence_duration_ms', value=300, interactive=True)
|
temp2 = gr.Number(label='temp_2', value=0.4, interactive=True)
|
||||||
speechPadMs = gr.Number(label='speech_pad_ms', value=200, interactive=True)
|
|
||||||
|
|
||||||
with gr.Accordion(label='Temperature'):
|
# Нижний акордион настроек для api ключа llm
|
||||||
temp0 = gr.Number(label='temp_0', value=0.0, interactive=True)
|
with gr.Accordion(label='ai.io.net api settings'):
|
||||||
temp1 = gr.Number(label='temp_1', value=0.2, interactive=True)
|
apiKey = gr.Textbox(label='API key', value=DEFAULT_API_KEY, interactive=True)
|
||||||
temp2 = gr.Number(label='temp_2', value=0.4, interactive=True)
|
|
||||||
|
|
||||||
# Нижний акордион настроек для api ключа llm
|
with gr.Accordion(label='System prompt'):
|
||||||
with gr.Accordion(label='ai.io.net api settings'):
|
systemPrompt = gr.Textbox(label='', value=DEFAULT_SYSTEM_PROMPT, interactive=True)
|
||||||
apiKey = gr.Textbox(label='API key', value=DEFAULT_API_KEY, interactive=True)
|
|
||||||
|
|
||||||
with gr.Accordion(label='System prompt'):
|
with gr.Row():
|
||||||
systemPrompt = gr.Textbox(label='', value=DEFAULT_SYSTEM_PROMPT, interactive=True)
|
llmModel = gr.Dropdown(label='models', choices=LLM_MODELS, value=LLM_MODELS[1], interactive=True)
|
||||||
|
llmTemperature = gr.Number(label='Temperature', value=0.8, interactive=True )
|
||||||
with gr.Row():
|
|
||||||
llmModel = gr.Dropdown(label='models', choices=LLM_MODELS, value=LLM_MODELS[1], interactive=True)
|
|
||||||
llmTemperature = gr.Number(label='Temperature', value=0.8, interactive=True )
|
|
||||||
|
|
||||||
with gr.Column():
|
|
||||||
with gr.Accordion(label='LLM'):
|
|
||||||
isPipelineEnabledCheckbox = gr.Checkbox(label='is pipeline enabled', value=True, interactive=True)
|
|
||||||
refineTextBtn = gr.Button('refine text', variant='secondary', interactive=False)
|
|
||||||
|
|
||||||
with gr.Accordion(label='Refined text raw'):
|
|
||||||
refinedText = gr.Textbox(label='', show_copy_button=True)
|
|
||||||
|
|
||||||
with gr.Accordion(label='Refined text md formated'):
|
|
||||||
refinedTextMD = gr.Markdown(label='')
|
|
||||||
|
|
||||||
|
######################################################################
|
||||||
|
#.____ .__ ___. .__ #
|
||||||
|
#| | ____ ____ |__| ____ \_ |__ ____ | | ______ _ __#
|
||||||
|
#| | / _ \ / ___\| |/ ___\ | __ \_/ __ \| | / _ \ \/ \/ /#
|
||||||
|
#| |__( <_> ) /_/ > \ \___ | \_\ \ ___/| |_( <_> ) / #
|
||||||
|
#|_______ \____/\___ /|__|\___ > |___ /\___ >____/\____/ \/\_/ #
|
||||||
|
# \/ /_____/ \/ \/ \/ #
|
||||||
|
######################################################################
|
||||||
|
|
||||||
isPipelineEnabledCheckbox.change(updateButton, inputs=[isPipelineEnabledCheckbox], outputs=refineTextBtn)
|
isPipelineEnabledCheckbox.change(updateButton, inputs=[isPipelineEnabledCheckbox], outputs=refineTextBtn)
|
||||||
saveFileCheckbox.change(updateTextbox, inputs=saveFileCheckbox, outputs=filename)
|
saveFileCheckbox.change(updateTextbox, inputs=saveFileCheckbox, outputs=filename)
|
||||||
|
|||||||
Reference in New Issue
Block a user