remove unused code
Browse files
app.py
CHANGED
@@ -460,37 +460,7 @@ with gr.Blocks(title="Climate Q&A", css_paths=os.getcwd()+ "/style.css", theme=t
|
|
460 |
graphs_container = gr.HTML("<h2>There are no graphs to be displayed at the moment. Try asking another question.</h2>")
|
461 |
current_graphs.change(lambda x : x, inputs=[current_graphs], outputs=[graphs_container])
|
462 |
|
463 |
-
|
464 |
-
# def display_default_recommended(current_graphs):
|
465 |
-
# if len(current_graphs)==0:
|
466 |
-
# placeholder_message = gr.HTML("<h2>There are no graphs to be displayed at the moment. Try asking another question.</h2>")
|
467 |
-
|
468 |
-
# @gr.render(inputs=[current_graphs],triggers=[chat_completed_state.change])
|
469 |
-
# def render_graphs(current_graph_list):
|
470 |
-
# global saved_graphs
|
471 |
-
# with gr.Column():
|
472 |
-
# print(f"\ncurrent_graph_list:\n{current_graph_list}")
|
473 |
-
# for (embedding, category) in current_graph_list:
|
474 |
-
# graphs_placeholder = gr.HTML(embedding, elem_id="graphs-placeholder")
|
475 |
-
# save_btn = gr.Button("Save Graph")
|
476 |
-
# save_btn.click(
|
477 |
-
# save_graph,
|
478 |
-
# [saved_graphs, gr.State(embedding), gr.State(category)],
|
479 |
-
# [saved_graphs, save_btn]
|
480 |
-
# )
|
481 |
-
|
482 |
-
|
483 |
-
# # Display current_graphs
|
484 |
-
# with gr.Row():
|
485 |
-
# for embedding in current_graphs:
|
486 |
-
# with gr.Column():
|
487 |
-
# gr.HTML(embedding, elem_id="graphs-placeholder")
|
488 |
-
# save_btn = gr.Button("Save Graph")
|
489 |
-
# save_btn.click(
|
490 |
-
# save_graph,
|
491 |
-
# [saved_graphs, gr.State(embedding)],
|
492 |
-
# [saved_graphs, save_btn]
|
493 |
-
# )
|
494 |
|
495 |
|
496 |
with gr.Tab("Configuration") as tab_config:
|
@@ -531,61 +501,6 @@ with gr.Blocks(title="Climate Q&A", css_paths=os.getcwd()+ "/style.css", theme=t
|
|
531 |
# OTHER TABS
|
532 |
#---------------------------------------------------------------------------------------
|
533 |
|
534 |
-
# with gr.Tab("Recommended content", elem_id="tab-recommended_content2") as recommended_content_tab2:
|
535 |
-
|
536 |
-
# @gr.render(inputs=[current_graphs])
|
537 |
-
# def display_default_recommended_head(current_graphs_list):
|
538 |
-
# if len(current_graphs_list)==0:
|
539 |
-
# gr.HTML("<h2>There are no graphs to be displayed at the moment. Try asking another question.</h2>")
|
540 |
-
|
541 |
-
# @gr.render(inputs=[current_graphs],triggers=[chat_completed_state.change])
|
542 |
-
# def render_graphs_head(current_graph_list):
|
543 |
-
# global saved_graphs
|
544 |
-
|
545 |
-
# category_dict = defaultdict(list)
|
546 |
-
# for (embedding, category) in current_graph_list:
|
547 |
-
# category_dict[category].append(embedding)
|
548 |
-
|
549 |
-
# for category in category_dict:
|
550 |
-
# with gr.Tab(category):
|
551 |
-
# splits = [category_dict[category][i:i+3] for i in range(0, len(category_dict[category]), 3)]
|
552 |
-
# for row in splits:
|
553 |
-
# with gr.Row():
|
554 |
-
# for embedding in row:
|
555 |
-
# with gr.Column():
|
556 |
-
# gr.HTML(embedding, elem_id="graphs-placeholder")
|
557 |
-
# save_btn = gr.Button("Save Graph")
|
558 |
-
# save_btn.click(
|
559 |
-
# save_graph,
|
560 |
-
# [saved_graphs, gr.State(embedding), gr.State(category)],
|
561 |
-
# [saved_graphs, save_btn]
|
562 |
-
# )
|
563 |
-
|
564 |
-
|
565 |
-
|
566 |
-
# with gr.Tab("Saved Graphs", elem_id="tab-saved-graphs") as saved_graphs_tab:
|
567 |
-
|
568 |
-
# @gr.render(inputs=[saved_graphs])
|
569 |
-
# def display_default_save(saved):
|
570 |
-
# if len(saved)==0:
|
571 |
-
# gr.HTML("<h2>You have not saved any graphs yet</h2>")
|
572 |
-
|
573 |
-
# @gr.render(inputs=[saved_graphs], triggers=[saved_graphs.change])
|
574 |
-
# def view_saved_graphs(graphs_list):
|
575 |
-
# categories = [category for category in graphs_list] # graphs_list.keys()
|
576 |
-
# for category in categories:
|
577 |
-
# with gr.Tab(category):
|
578 |
-
# splits = [graphs_list[category][i:i+3] for i in range(0, len(graphs_list[category]), 3)]
|
579 |
-
# for row in splits:
|
580 |
-
# with gr.Row():
|
581 |
-
# for graph in row:
|
582 |
-
# gr.HTML(graph, elem_id="graphs-placeholder")
|
583 |
-
|
584 |
-
|
585 |
-
|
586 |
-
# with gr.Tab("Figures",elem_id = "tab-images",elem_classes = "max-height other-tabs"):
|
587 |
-
# gallery_component = gr.Gallery(object_fit='cover')
|
588 |
-
|
589 |
with gr.Tab("Settings",elem_id = "tab-config",id = 2):
|
590 |
|
591 |
gr.Markdown("Reminder: You can talk in any language, ClimateQ&A is multi-lingual!")
|
@@ -618,32 +533,7 @@ with gr.Blocks(title="Climate Q&A", css_paths=os.getcwd()+ "/style.css", theme=t
|
|
618 |
output_query = gr.Textbox(label="Query used for retrieval",show_label = True,elem_id = "reformulated-query",lines = 2,interactive = False)
|
619 |
output_language = gr.Textbox(label="Language",show_label = True,elem_id = "language",lines = 1,interactive = False)
|
620 |
|
621 |
-
# with gr.Tab("Papers (beta)",elem_id = "tab-papers",elem_classes = "max-height other-tabs"):
|
622 |
-
|
623 |
-
# with gr.Row():
|
624 |
-
# with gr.Column(scale=1):
|
625 |
-
# query_papers = gr.Textbox(placeholder="Question",show_label=False,lines = 1,interactive = True,elem_id="query-papers")
|
626 |
-
# keywords_papers = gr.Textbox(placeholder="Keywords",show_label=False,lines = 1,interactive = True,elem_id="keywords-papers")
|
627 |
-
# after = gr.Slider(minimum=1950,maximum=2023,step=1,value=1960,label="Publication date",show_label=True,interactive=True,elem_id="date-papers")
|
628 |
-
# search_papers = gr.Button("Search",elem_id="search-papers",interactive=True)
|
629 |
|
630 |
-
# with gr.Column(scale=7):
|
631 |
-
|
632 |
-
# with gr.Tab("Summary",elem_id="papers-summary-tab"):
|
633 |
-
# papers_summary = gr.Markdown(visible=True,elem_id="papers-summary")
|
634 |
-
|
635 |
-
# with gr.Tab("Relevant papers",elem_id="papers-results-tab"):
|
636 |
-
# papers_dataframe = gr.Dataframe(visible=True,elem_id="papers-table",headers = papers_cols)
|
637 |
-
|
638 |
-
# with gr.Tab("Citations network",elem_id="papers-network-tab"):
|
639 |
-
# citations_network = gr.HTML(visible=True,elem_id="papers-citations-network")
|
640 |
-
|
641 |
-
# with gr.Tab("Saved Graphs", elem_id="tab-saved-graphs", id=4) as saved_graphs_tab:
|
642 |
-
# @gr.render(inputs=[saved_graphs], triggers=[saved_graphs.change])
|
643 |
-
# def view_saved_graphs(graphs_list):
|
644 |
-
# for graph in graphs_list:
|
645 |
-
# gr.HTML(graph, elem_id="graphs-placeholder")
|
646 |
-
|
647 |
with gr.Tab("About",elem_classes = "max-height other-tabs"):
|
648 |
with gr.Row():
|
649 |
with gr.Column(scale=1):
|
|
|
460 |
graphs_container = gr.HTML("<h2>There are no graphs to be displayed at the moment. Try asking another question.</h2>")
|
461 |
current_graphs.change(lambda x : x, inputs=[current_graphs], outputs=[graphs_container])
|
462 |
|
463 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
464 |
|
465 |
|
466 |
with gr.Tab("Configuration") as tab_config:
|
|
|
501 |
# OTHER TABS
|
502 |
#---------------------------------------------------------------------------------------
|
503 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
504 |
with gr.Tab("Settings",elem_id = "tab-config",id = 2):
|
505 |
|
506 |
gr.Markdown("Reminder: You can talk in any language, ClimateQ&A is multi-lingual!")
|
|
|
533 |
output_query = gr.Textbox(label="Query used for retrieval",show_label = True,elem_id = "reformulated-query",lines = 2,interactive = False)
|
534 |
output_language = gr.Textbox(label="Language",show_label = True,elem_id = "language",lines = 1,interactive = False)
|
535 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
536 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
537 |
with gr.Tab("About",elem_classes = "max-height other-tabs"):
|
538 |
with gr.Row():
|
539 |
with gr.Column(scale=1):
|