shengxio commited on
Commit
9e5e3d5
1 Parent(s): 88acd41

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +51 -52
app.py CHANGED
@@ -1,53 +1,52 @@
1
- import gradio as gr
2
- from supplier import *
3
- from tools import material_manager, project_manager
4
-
5
- BASE_SAMPLES = ["What can you help me with?","What materials do we have?","What projects do we have today?"]
6
-
7
- # create a system setting for llm
8
- with gr.Blocks() as supply_chain_view:
9
- with gr.Row():
10
- with gr.Column():
11
- gr.Label("Projects")
12
- project_table = gr.Dataframe(project_manager.get_items())
13
-
14
- with gr.Column():
15
- gr.Label("Materials")
16
- material_table = gr.DataFrame(material_manager.get_items())
17
-
18
- with gr.Blocks() as chat_window:
19
- with gr.Row():
20
- with gr.Column():
21
- chatbot = gr.Chatbot([])
22
- chatbot_speech = gr.Audio()
23
- with gr.Column():
24
- chat_clear = gr.Button("Clear")
25
- play_speech = gr.Button("Play")
26
- chat_clear.click(lambda:None,None,chatbot,queue=False)
27
- play_speech.click(text_to_audio,chatbot,chatbot_speech,queue=False)
28
-
29
- with gr.Column():
30
- msg = gr.Textbox()
31
- submit = gr.Button("Submit")
32
- gr.Examples(BASE_SAMPLES,msg,label="Examples")
33
- audio = gr.Audio(sources="microphone",type="filepath")
34
-
35
- audio.change(translate,audio,msg,queue=False)
36
- msg.submit(send_chat,[msg,chatbot],[msg,chatbot])
37
- submit.click(send_chat,[msg,chatbot],[msg,chatbot],queue=False)
38
-
39
-
40
-
41
- iface = gr.TabbedInterface(
42
- [chat_window,supply_chain_view],
43
- ["Chat","Supply Chain View"],
44
- title="MiMinions.ai",
45
- css="footer {visibility: hidden}")
46
-
47
- if __name__ == "__main__":
48
- iface.launch(
49
- auth=[ ("admin","hello world"),
50
- ("guest","p@55word")],
51
- server_port=8000,
52
- # share=True,
53
  )
 
1
+ import gradio as gr
2
+ from supplier import *
3
+ from tools import material_manager, project_manager
4
+
5
+ BASE_SAMPLES = ["What can you help me with?","What materials do we have?","What projects do we have today?"]
6
+
7
+ # create a system setting for llm
8
+ with gr.Blocks() as supply_chain_view:
9
+ with gr.Row():
10
+ with gr.Column():
11
+ gr.Label("Projects")
12
+ project_table = gr.Dataframe(project_manager.get_items())
13
+
14
+ with gr.Column():
15
+ gr.Label("Materials")
16
+ material_table = gr.DataFrame(material_manager.get_items())
17
+
18
+ with gr.Blocks() as chat_window:
19
+ with gr.Row():
20
+ with gr.Column():
21
+ chatbot = gr.Chatbot([])
22
+ chatbot_speech = gr.Audio()
23
+ with gr.Column():
24
+ chat_clear = gr.Button("Clear")
25
+ play_speech = gr.Button("Play")
26
+ chat_clear.click(lambda:None,None,chatbot,queue=False)
27
+ play_speech.click(text_to_audio,chatbot,chatbot_speech,queue=False)
28
+
29
+ with gr.Column():
30
+ msg = gr.Textbox()
31
+ submit = gr.Button("Submit")
32
+ gr.Examples(BASE_SAMPLES,msg,label="Examples")
33
+ audio = gr.Audio(sources="microphone",type="filepath")
34
+
35
+ audio.change(translate,audio,msg,queue=False)
36
+ msg.submit(send_chat,[msg,chatbot],[msg,chatbot])
37
+ submit.click(send_chat,[msg,chatbot],[msg,chatbot],queue=False)
38
+
39
+
40
+
41
+ iface = gr.TabbedInterface(
42
+ [chat_window,supply_chain_view],
43
+ ["Chat","Supply Chain View"],
44
+ title="MiMinions.ai",
45
+ css="footer {visibility: hidden}")
46
+
47
+ if __name__ == "__main__":
48
+ iface.launch(
49
+ auth=[ ("admin","hello world"),
50
+ ("guest","p@55word")],
51
+ # share=True,
 
52
  )