matthoffner commited on
Commit
3e05251
Β·
1 Parent(s): 978dd3d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +26 -6
app.py CHANGED
@@ -18,6 +18,15 @@ with gr.Blocks(css="") as demo:
18
 
19
  chat_context = gr.State([])
20
  new_google_chat_context = gr.State([])
 
 
 
 
 
 
 
 
 
21
 
22
  with gr.Tab("Upload"):
23
  with gr.Row():
@@ -43,8 +52,10 @@ with gr.Blocks(css="") as demo:
43
 
44
  with gr.Tab("Search"):
45
  with gr.Row():
 
 
46
  with gr.Column(scale=3):
47
- search_options_checkbox = gr.CheckboxGroup(label="APIs", choices=["πŸ“š Google", "🏑 Porch", "Your API Here"])
48
  chatbot = gr.Chatbot()
49
  with gr.Row():
50
  with gr.Column(min_width=50, scale=1):
@@ -54,11 +65,20 @@ with gr.Blocks(css="") as demo:
54
  with gr.Column(min_width=50, scale=1):
55
  chat_submit_btn = gr.Button("πŸš€", variant="primary")
56
 
57
- index_select = []
58
- prompt_tmpl = prompt_tmpl_dict["Default"]
59
- refine_tmpl = refine_tmpl_dict["Default"]
60
- sim_k = 1
61
- chat_tone = 0.7
 
 
 
 
 
 
 
 
 
62
  chat_input.submit(chat_ai, [index_select, chat_input, prompt_tmpl, refine_tmpl, sim_k, chat_tone, chat_context, chatbot, search_options_checkbox], [chat_context, chatbot])
63
  chat_input.submit(reset_textbox, [], [chat_input])
64
  chat_submit_btn.click(chat_ai, [index_select, chat_input, prompt_tmpl, refine_tmpl, sim_k, chat_tone, chat_context, chatbot, search_options_checkbox], [chat_context, chatbot])
 
18
 
19
  chat_context = gr.State([])
20
  new_google_chat_context = gr.State([])
21
+ with gr.Row():
22
+ with gr.Column(scale=3):
23
+ with gr.Box():
24
+ gr.Markdown("**Indicies**")
25
+ with gr.Row():
26
+ with gr.Column(scale=12):
27
+ index_select = gr.Dropdown(choices=refresh_json_list(plain=True), value="index", show_label=False, multiselect=False).style(container=False)
28
+ with gr.Column(min_width=30, scale=1):
29
+ index_refresh_btn = gr.Button("πŸ”„").style()
30
 
31
  with gr.Tab("Upload"):
32
  with gr.Row():
 
52
 
53
  with gr.Tab("Search"):
54
  with gr.Row():
55
+ with gr.Column(scale=1):
56
+ chat_tone = gr.Radio(["smart", "concise", "creative"], label="chat_tone", type="index", value="concise")
57
  with gr.Column(scale=3):
58
+ search_options_checkbox = gr.CheckboxGroup(label="Todo: APIs", choices=["πŸ“š Google", "🏑 Porch", "Your API Here"])
59
  chatbot = gr.Chatbot()
60
  with gr.Row():
61
  with gr.Column(min_width=50, scale=1):
 
65
  with gr.Column(min_width=50, scale=1):
66
  chat_submit_btn = gr.Button("πŸš€", variant="primary")
67
 
68
+
69
+ with gr.Tab("Setting"):
70
+ with gr.Row():
71
+ sim_k = gr.Slider(1, 10, 3, step=1, label="similarity_topk", interactive=True, show_label=True)
72
+ tempurature = gr.Slider(0, 2, 0.5, step=0.1, label="tempurature", interactive=True, show_label=True)
73
+ with gr.Row():
74
+ with gr.Column():
75
+ tmpl_select = gr.Radio(list(prompt_tmpl_dict.keys()), value="Default", label="Prompt", interactive=True)
76
+ prompt_tmpl = gr.Textbox(value=prompt_tmpl_dict["Default"] ,lines=10, max_lines=40 ,show_label=False)
77
+ with gr.Column():
78
+ refine_select = gr.Radio(list(refine_tmpl_dict.keys()), value="Default", label="Refine", interactive=True)
79
+ refine_tmpl = gr.Textbox(value=refine_tmpl_dict["Default"] ,lines=10, max_lines=40 ,show_label=False)
80
+
81
+
82
  chat_input.submit(chat_ai, [index_select, chat_input, prompt_tmpl, refine_tmpl, sim_k, chat_tone, chat_context, chatbot, search_options_checkbox], [chat_context, chatbot])
83
  chat_input.submit(reset_textbox, [], [chat_input])
84
  chat_submit_btn.click(chat_ai, [index_select, chat_input, prompt_tmpl, refine_tmpl, sim_k, chat_tone, chat_context, chatbot, search_options_checkbox], [chat_context, chatbot])