|
|
|
|
|
import psutil |
|
|
|
from streamlit_mic_recorder import mic_recorder |
|
|
|
|
|
from audio_processing.A2T import A2T |
|
from audio_processing.T2A import T2A |
|
from command.utils import build_chain |
|
from llm.llm_factory import LLM_Factory |
|
|
|
llm_model = LLM_Factory() |
|
|
|
trigger = {"lc": "small"} |
|
|
|
|
|
def prepare_cor(input_text: str): |
|
return build_chain.build_command_chain().handle_command(input_text) |
|
|
|
|
|
def main(): |
|
mic = mic_recorder(start_prompt="Record", stop_prompt="Stop", just_once=True) |
|
|
|
if mic is not None: |
|
a2t = A2T(mic["bytes"]) |
|
text = a2t.predict() |
|
|
|
llm = llm_model.create_llm(prompt_entity=text, prompt_id=1, trigger=trigger) |
|
response = llm.execution() if llm is not None else "Oops occurred some error. Please try again" |
|
|
|
t2a = T2A(response) |
|
t2a.autoplay() |
|
|
|
|
|
if __name__ == "__main__": |
|
print('RAM memory % used:', psutil.virtual_memory()[2]) |
|
main() |
|
|