File size: 1,736 Bytes
2d71161
 
b1da122
2d71161
2bf90a8
2d71161
d415e7e
d6f25ed
b1da122
 
 
 
 
 
 
 
2d71161
 
 
 
d415e7e
 
 
 
2bf90a8
d415e7e
2bf90a8
d415e7e
2d71161
 
 
2bf90a8
f5f1842
2d71161
175ac78
d415e7e
 
 
2d71161
 
 
d6f25ed
b1da122
d415e7e
2d71161
 
 
b1da122
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
import gradio as gr
from supplier import *
from tools import material_manager, project_manager

BASE_SAMPLES = ["What can you help me with?","What materials do we have?","What projects do we have today?"]

# create a system setting for llm
with gr.Blocks() as supply_chain_view:
    with gr.Row():
        with gr.Column():
            gr.Label("Projects")
            project_table = gr.Dataframe(project_manager.get_items())
        
        with gr.Column():
            gr.Label("Materials")
            material_table = gr.DataFrame(material_manager.get_items())
            
with gr.Blocks() as chat_window:
    with gr.Row():
        with gr.Column():
            chatbot = gr.Chatbot([])
            chatbot_speech = gr.Audio()
            with gr.Column():
                chat_clear = gr.Button("Clear")
                play_speech = gr.Button("Play")
        chat_clear.click(lambda:None,None,chatbot,queue=False)
        play_speech.click(text_to_audio,chatbot,chatbot_speech,queue=False)

        with gr.Column():
            msg = gr.Textbox()
            submit = gr.Button("Submit")
            gr.Examples(BASE_SAMPLES,msg,label="Examples")
            audio = gr.Audio(sources="microphone",type="filepath")

        audio.change(transcript,audio,msg,queue=False)
        msg.submit(send_chat,[msg,chatbot],[msg,chatbot])
        submit.click(send_chat,[msg,chatbot],[msg,chatbot],queue=False)



iface = gr.TabbedInterface(
    [chat_window,supply_chain_view],
    ["Chat","Supply Chain View"],
    title="MiMinions.ai",
    css="footer {visibility: hidden}")

if __name__ == "__main__":
    iface.launch(
        auth=[  ("admin","hello world"),
                ("guest","p@55word")],
        server_port=8000,
    )