momenaca commited on
Commit
dcf594a
1 Parent(s): 2676f5d

update frontend with tabs

Browse files
Files changed (1) hide show
  1. app.py +42 -30
app.py CHANGED
@@ -220,38 +220,50 @@ with gr.Blocks(title=f"{demo_name}", css=css, theme=theme) as demo:
220
  # )
221
 
222
  with gr.Column(visible=True) as bloc_2:
223
- gr.Markdown(f"<h1><center>{demo_name}</center></h1>")
224
- with gr.Row():
225
- with gr.Column(scale=2):
226
- chatbot = gr.Chatbot(
227
- value=[(None, init_prompt)],
228
- show_copy_button=True,
229
- show_label=False,
230
- elem_id="chatbot",
231
- layout="panel",
232
- avatar_images=(None, "https://i.ibb.co/YNyd5W2/logo4.png"),
233
- )
234
- state = gr.State([])
235
-
236
- with gr.Row():
237
- ask = gr.Textbox(
238
  show_label=False,
239
- placeholder="Input your question then press enter",
 
 
240
  )
241
-
242
- with gr.Column(scale=1, variant="panel"):
243
- gr.Markdown("### Sources")
244
- sources_textbox = gr.Markdown(show_label=False)
245
-
246
- # demo.load(update_visible, inputs=None, outputs=[bloc_1, bloc_2, bloc_3])
247
- ask.submit(
248
- fn=chat,
249
- inputs=[
250
- ask,
251
- state,
252
- ],
253
- outputs=[ask, chatbot, state, sources_textbox],
254
- )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
255
 
256
 
257
  demo.launch(
 
220
  # )
221
 
222
  with gr.Column(visible=True) as bloc_2:
223
+ with gr.Tab("ESRS Q&A"):
224
+ with gr.Row():
225
+ with gr.Column(scale=2):
226
+ chatbot = gr.Chatbot(
227
+ value=[(None, init_prompt)],
228
+ show_copy_button=True,
 
 
 
 
 
 
 
 
 
229
  show_label=False,
230
+ elem_id="chatbot",
231
+ layout="panel",
232
+ avatar_images=(None, "https://i.ibb.co/YNyd5W2/logo4.png"),
233
  )
234
+ state = gr.State([])
235
+
236
+ with gr.Row(elem_id="input-message"):
237
+ ask = gr.Textbox(
238
+ placeholder="Ask me anything here!",
239
+ show_label=False,
240
+ scale=7,
241
+ lines=1,
242
+ interactive=True,
243
+ elem_id="input-textbox",
244
+ )
245
+
246
+ with gr.Column(scale=1, variant="panel", elem_id="right-panel"):
247
+ with gr.Tab("Sources", elem_id="tab-citations", id=1):
248
+ sources_textbox = gr.HTML(
249
+ show_label=False, elem_id="sources-textbox"
250
+ )
251
+ docs_textbox = gr.State("")
252
+
253
+ with gr.Tab("About", elem_classes="max-height other-tabs"):
254
+ with gr.Row():
255
+ with gr.Column(scale=1):
256
+ gr.Markdown("WIP")
257
+
258
+ # demo.load(update_visible, inputs=None, outputs=[bloc_1, bloc_2, bloc_3])
259
+ ask.submit(
260
+ fn=chat,
261
+ inputs=[
262
+ ask,
263
+ state,
264
+ ],
265
+ outputs=[ask, chatbot, state, sources_textbox],
266
+ )
267
 
268
 
269
  demo.launch(