Spaces:
Sleeping
Sleeping
File size: 1,222 Bytes
34e8e70 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 | import gradio as gr
from main2 import search_trials # Importing from main2.py
def run_search(age, sex, state, keywords):
results = search_trials(
user_age=age,
user_sex=sex,
user_state=state,
user_keywords=keywords
)
return results
with gr.Blocks() as demo:
gr.Markdown("# Clinical Trials Search Tool")
gr.Markdown(
"Find **recruiting US clinical trials** that match your **age**, **sex**, "
"**state**, and optional **keywords**."
)
with gr.Row():
age_input = gr.Number(label="Your Age", value=30)
sex_input = gr.Dropdown(["Male", "Female"], label="Sex", value="Male")
with gr.Row():
state_input = gr.Textbox(label="State (full name or abbreviation)", placeholder="e.g., California")
keywords_input = gr.Textbox(label="Keywords (comma separated)", placeholder="e.g., cancer, diabetes")
search_btn = gr.Button("Search Trials")
output_table = gr.Dataframe(label="Matching Trials", interactive=False)
search_btn.click(
fn=run_search,
inputs=[age_input, sex_input, state_input, keywords_input],
outputs=output_table
)
if __name__ == "__main__":
demo.launch()
|