Spaces:
Sleeping
Sleeping
update frontend with tabs
Browse files
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.
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
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 |
-
|
|
|
|
|
240 |
)
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
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(
|