AAAAAA
This commit is contained in:
parent
8a7573f169
commit
26118e4898
@ -1,21 +1,80 @@
|
||||
import gradio as gr
|
||||
from core import Core
|
||||
import os
|
||||
|
||||
def start_assistant(phone_number, order_items, delivery_address, payment_method):
|
||||
global assistant
|
||||
assistant.set_order_settings(
|
||||
phone_number,
|
||||
order_items,
|
||||
delivery_address,
|
||||
payment_method
|
||||
)
|
||||
assistant.assistant_start()
|
||||
|
||||
def proceed():
|
||||
print("ok")
|
||||
|
||||
def stop_assistant():
|
||||
assistant.assistant_stop()
|
||||
|
||||
|
||||
def set_advanced_settings(speech_recog_timeout, window_size_sec, vad_threshold, min_silence_duration_ms, speech_pad_ms):
|
||||
assistant.set_speech_recog_settings(
|
||||
speech_recog_timeout,
|
||||
window_size_sec,
|
||||
vad_threshold,
|
||||
min_silence_duration_ms,
|
||||
speech_pad_ms
|
||||
)
|
||||
|
||||
def set_voice_wav(speaker_wav):
|
||||
speaker_wav = os.path.join(cwd, "voices", speaker_wav)
|
||||
assistant.set_tts_settings(speaker_wav)
|
||||
|
||||
|
||||
assistant = Core(
|
||||
use_chatgpt_placeholder = True
|
||||
)
|
||||
|
||||
cwd = os.path.dirname(os.path.realpath(__file__))
|
||||
|
||||
|
||||
with gr.Blocks() as demo:
|
||||
txt_2 = gr.Textbox(label="Podaj Twój nr telefonu", lines=1)
|
||||
txt_2 = gr.Textbox(label="Co chcesz zamówić?", lines=2)
|
||||
txt_3 = gr.Textbox(label="Na jaki adres?")
|
||||
txt_4 = gr.Textbox(label="Dodatkowe informacje", lines=2)
|
||||
gr.Dropdown(["Wejściowe", "Wyjściowe"], label="Urządzenie", info="Wybierz urządzenie audio!"),
|
||||
gr.Radio(["inteigentna osoba", "50/50", "głupek"], label="Jaki rodzaj osoby udawać"),
|
||||
gr.Radio(["hitler", "stuu", "lektor","belmondawg","sasza", "villager"], label="Głos", info="Jakiego głosu użyć?"),
|
||||
btn = gr.Button(value="Submit")
|
||||
btn.click(proceed)
|
||||
with gr.Tab("Basic Settings"):
|
||||
with gr.Row():
|
||||
phone_number = gr.Textbox(label="Twój Nr. Telefonu")
|
||||
order_items = gr.Textbox(label="Zamówienie", lines=5)
|
||||
delivery_address = gr.Textbox(label="Adres dostawy")
|
||||
payment_method = gr.Dropdown(label="Metoda płatności", choices=["Gotówka", "Karta"])
|
||||
with gr.Column():
|
||||
speaker_wav = gr.Textbox(label="Wav głosu", value="lector.wav")
|
||||
set_voice = gr.Button("Ustaw głos")
|
||||
|
||||
if __name__ == "__main__":
|
||||
demo.launch()
|
||||
# init settings
|
||||
#assistant.set_tts_settings(speaker_wav.value)
|
||||
set_voice_wav(speaker_wav.value)
|
||||
|
||||
#set_voice.click(assistant.set_tts_settings, inputs=[speaker_wav], outputs=[])
|
||||
set_voice.click(set_voice_wav, inputs=[speaker_wav], outputs=[])
|
||||
with gr.Row():
|
||||
start_btn = gr.Button("Start Pizzobota")
|
||||
stop_btn = gr.Button("Stop Pizzobota")
|
||||
|
||||
|
||||
|
||||
start_btn.click(start_assistant, inputs=[phone_number, order_items, delivery_address, payment_method], outputs=[])
|
||||
stop_btn.click(stop_assistant, inputs=[])
|
||||
|
||||
with gr.Tab("Advanced Settings"):
|
||||
speech_recog_timeout = gr.Number(label="Speech Recog Timeout (sec)", value=1)
|
||||
window_size_sec = gr.Number(label="Window Size (sec)", value=0.1)
|
||||
vad_threshold = gr.Number(label="VAD Threshold", value=0.65)
|
||||
min_silence_duration_ms = gr.Number(label="Min Silence Duration (ms)", value=250)
|
||||
speech_pad_ms = gr.Number(label="Speech Pad (ms)", value=0)
|
||||
|
||||
# init settings
|
||||
set_advanced_settings(speech_recog_timeout.value, window_size_sec.value, vad_threshold.value, min_silence_duration_ms.value, speech_pad_ms.value)
|
||||
|
||||
set_adv_btn = gr.Button("Ustaw")
|
||||
set_adv_btn.click(set_advanced_settings, inputs=[speech_recog_timeout, window_size_sec, vad_threshold, min_silence_duration_ms, speech_pad_ms], outputs=[])
|
||||
|
||||
demo.launch()
|
@ -10,7 +10,7 @@
|
||||
"\n",
|
||||
"core = Core(\n",
|
||||
" whisper_model_name = \"large-v3\",\n",
|
||||
" use_chatgpt_placeholder = False\n",
|
||||
" use_chatgpt_placeholder = False,\n",
|
||||
")"
|
||||
]
|
||||
},
|
||||
@ -22,18 +22,18 @@
|
||||
"source": [
|
||||
"core.set_order_settings(\n",
|
||||
" phone_number = \"123456789\",\n",
|
||||
" order_items = \"2x margherita\\n3x sos czosnkowy\\n2x pepsi 1.5l\",\n",
|
||||
" delivery_address = \"ulica Kielecka 16A, Opole\",\n",
|
||||
" order_items = \"1x pizza margheritta 42 centrymetrów\\n1x sos pomidorowy\\n1x sos czosnkowy\",\n",
|
||||
" delivery_address = \"ul. Amogusowa 16A\",\n",
|
||||
" payment_method = \"gotówka\"\n",
|
||||
")\n",
|
||||
"\n",
|
||||
"core.set_speech_recog_settings(\n",
|
||||
" speech_recog_timeout = 2.5,\n",
|
||||
" speech_recog_timeout = 1.0,\n",
|
||||
" #audio_input_device_name = \"Virtual\",\n",
|
||||
" #audio_output_device_name = \"placeholder\",\n",
|
||||
" window_size_sec = 0.1,\n",
|
||||
" vad_threshold = 0.6,\n",
|
||||
" min_silence_duration_ms = 150,\n",
|
||||
" vad_threshold = 0.65,\n",
|
||||
" min_silence_duration_ms = 250,\n",
|
||||
" speech_pad_ms = 0\n",
|
||||
")"
|
||||
]
|
||||
|
Loading…
Reference in New Issue
Block a user