phosseini's picture
Update app.py
177fbb5 verified
#!/usr/bin/env python
from __future__ import annotations
import gradio as gr
from dataset_list import DatasetList
DESCRIPTION = '# Explore Medical Question Answering Datasets 🏥'
NOTES = '''
'''
FOOTER = ''''''
def main():
dataset_list = DatasetList()
with gr.Blocks(css='style.css') as demo:
gr.Markdown(DESCRIPTION)
search_box = gr.Textbox(
label='Search Dataset Name',
placeholder=
'You can search for titles with regular expressions. e.g. (?<!sur)face',
max_lines=1)
case_sensitive = gr.Checkbox(label='Case Sensitive')
filter_names = gr.CheckboxGroup(choices=[
'Data Link',
'Paper',
], label='Filter')
search_button = gr.Button('Search')
number_of_datasets = gr.Textbox(label='Number of Datasets Found')
table = gr.HTML(show_label=False)
gr.Markdown(NOTES)
gr.Markdown(FOOTER)
demo.load(fn=dataset_list.render,
inputs=[
search_box,
case_sensitive,
filter_names
],
outputs=[
number_of_datasets,
table,
])
search_box.submit(fn=dataset_list.render,
inputs=[
search_box,
case_sensitive,
filter_names
],
outputs=[
number_of_datasets,
table,
])
search_button.click(fn=dataset_list.render,
inputs=[
search_box,
case_sensitive,
filter_names
],
outputs=[
number_of_datasets,
table,
])
demo.launch(share=False)
if __name__ == '__main__':
main()