-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathui.py
More file actions
30 lines (23 loc) · 848 Bytes
/
ui.py
File metadata and controls
30 lines (23 loc) · 848 Bytes
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
import gradio as gr
from gradio.themes.base import Base
class ChatUI:
def __init__(self, chat_service):
self.chat_service = chat_service
def launch(self):
with gr.Blocks(theme=Base()) as demo:
gr.Markdown("## Customer Financial Chatbot")
customer = gr.Radio(
choices=self.chat_service.get_customer_names(),
label="Select Customer"
)
question = gr.Textbox(
label="Ask a question",
placeholder="What is the total value of all buy transactions?"
)
answer = gr.Textbox(lines=8, label="Answer")
gr.Button("Ask").click(
fn=self.chat_service.chat,
inputs=[customer, question],
outputs=answer
)
demo.launch()