Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -227,8 +227,8 @@ async def run_function_on_text(top_k,study_obj,study_type,phase,purpose,allocati
|
|
| 227 |
n,
|
| 228 |
f'<a href="https://clinicaltrials.gov/study/{nct_id}"><u>{nct_id}</u></a>',
|
| 229 |
study_name,
|
| 230 |
-
|
| 231 |
-
|
| 232 |
]
|
| 233 |
|
| 234 |
formatted_ref.append(formatted_trial)
|
|
@@ -247,17 +247,6 @@ async def run_function_on_text(top_k,study_obj,study_type,phase,purpose,allocati
|
|
| 247 |
combine_criteira = await clean_trial_text(combine_criteira)
|
| 248 |
return combine_criteira,formatted_ref
|
| 249 |
|
| 250 |
-
# #Extract criteria
|
| 251 |
-
# if query_response.response == "Empty Response":
|
| 252 |
-
# return query_response,formatted_ref
|
| 253 |
-
# else:
|
| 254 |
-
# removed_ref = await remove_ref(query_response.response)
|
| 255 |
-
# combine_criteira = re.sub(r'##\s*', '', removed_ref).strip()
|
| 256 |
-
# combine_criteira = re.sub(r'#\s*', '', combine_criteira).strip()
|
| 257 |
-
# combine_criteira = re.sub(r'\*\*', '', combine_criteira).strip()
|
| 258 |
-
# combine_criteira = re.sub(r'(Criteria)\n\s*\n(\d+\.)', r'\1\n\2', combine_criteira).strip()
|
| 259 |
-
# return combine_criteira,formatted_ref
|
| 260 |
-
|
| 261 |
# # LLM.complete
|
| 262 |
# complete_response = await llm.acomplete(f"""
|
| 263 |
# Based on the provided instructions and clinical trial information, generate the new eligibility criteria by analyzing clinical trial information(### Clinical Trial Information).
|
|
@@ -396,14 +385,11 @@ interventions_place_holder = f"""Example:
|
|
| 396 |
- Drug: Amoxicillin hydrate
|
| 397 |
- Amoxicillin hydrate (potency)
|
| 398 |
|
| 399 |
-
- Procedure: Stem cell transplant
|
| 400 |
-
- See Detailed Description section for details of treatment interventions.
|
| 401 |
-
|
| 402 |
- Biological: Pneumococcal Vaccine
|
| 403 |
- Subcutaneously on Day 0
|
| 404 |
- Other Names:
|
| 405 |
- Prevnar
|
| 406 |
-
|
| 407 |
- Drug: Doxorubicin, Cotrimoxazole, Carboplatin, Ifosfamide
|
| 408 |
|
| 409 |
- Drug: Irinotecan
|
|
@@ -415,8 +401,6 @@ interventions_place_holder = f"""Example:
|
|
| 415 |
- Placebo tablet
|
| 416 |
"""
|
| 417 |
|
| 418 |
-
prefilled_value = f"""[Clinicaltrials.gov](https://clinicaltrials.gov/) """
|
| 419 |
-
|
| 420 |
with gr.Blocks() as demo:
|
| 421 |
|
| 422 |
with gr.Row():
|
|
@@ -434,8 +418,7 @@ with gr.Blocks() as demo:
|
|
| 434 |
gr.Markdown("# Research Information"),
|
| 435 |
with gr.Row():
|
| 436 |
study_obj_box = gr.Textbox(
|
| 437 |
-
label="Study Objective / Study Description",
|
| 438 |
-
# placeholder=prefilled_value,
|
| 439 |
placeholder=objective_place_holder,
|
| 440 |
lines=10)
|
| 441 |
# Conditions
|
|
@@ -513,7 +496,7 @@ with gr.Blocks() as demo:
|
|
| 513 |
with gr.Row():
|
| 514 |
ref_table = gr.Dataframe(
|
| 515 |
label="Reference",
|
| 516 |
-
headers=["No.",'Link', 'Study name', '
|
| 517 |
datatype=["markdown","html","markdown", "markdown","markdown"],
|
| 518 |
wrap=True,
|
| 519 |
interactive=False)
|
|
@@ -578,44 +561,4 @@ with gr.Blocks() as demo:
|
|
| 578 |
clear_all_button.click(lambda : [None] * len(all_information), outputs=all_information)
|
| 579 |
|
| 580 |
if __name__ == "__main__":
|
| 581 |
-
demo.launch(debug=True)
|
| 582 |
-
|
| 583 |
-
# custom_css = """
|
| 584 |
-
# .gradio-container {
|
| 585 |
-
# font-family: 'Roboto', sans-serif;
|
| 586 |
-
# }
|
| 587 |
-
# .main-header {
|
| 588 |
-
# text-align: center;
|
| 589 |
-
# color: #4a4a4a;
|
| 590 |
-
# margin-bottom: 2rem;
|
| 591 |
-
# }
|
| 592 |
-
# .tab-header {
|
| 593 |
-
# font-size: 1.2rem;
|
| 594 |
-
# font-weight: bold;
|
| 595 |
-
# margin-bottom: 1rem;
|
| 596 |
-
# }
|
| 597 |
-
# .custom-chatbot {
|
| 598 |
-
# border-radius: 10px;
|
| 599 |
-
# box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
|
| 600 |
-
# }
|
| 601 |
-
# .custom-button {
|
| 602 |
-
# background-color: #3498db;
|
| 603 |
-
# color: white;
|
| 604 |
-
# border: none;
|
| 605 |
-
# padding: 10px 20px;
|
| 606 |
-
# border-radius: 5px;
|
| 607 |
-
# cursor: pointer;
|
| 608 |
-
# transition: background-color 0.3s ease;
|
| 609 |
-
# }
|
| 610 |
-
# .custom-button:hover {
|
| 611 |
-
# background-color: #2980b9;
|
| 612 |
-
# }
|
| 613 |
-
# """
|
| 614 |
-
|
| 615 |
-
# # Define Gradio theme
|
| 616 |
-
# theme = gr.themes.Default(
|
| 617 |
-
# primary_hue="zinc",
|
| 618 |
-
# secondary_hue="red",
|
| 619 |
-
# neutral_hue="neutral",
|
| 620 |
-
# font=[gr.themes.GoogleFont('Roboto'), "sans-serif"]
|
| 621 |
-
# )
|
|
|
|
| 227 |
n,
|
| 228 |
f'<a href="https://clinicaltrials.gov/study/{nct_id}"><u>{nct_id}</u></a>',
|
| 229 |
study_name,
|
| 230 |
+
intervention,
|
| 231 |
+
condition
|
| 232 |
]
|
| 233 |
|
| 234 |
formatted_ref.append(formatted_trial)
|
|
|
|
| 247 |
combine_criteira = await clean_trial_text(combine_criteira)
|
| 248 |
return combine_criteira,formatted_ref
|
| 249 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 250 |
# # LLM.complete
|
| 251 |
# complete_response = await llm.acomplete(f"""
|
| 252 |
# Based on the provided instructions and clinical trial information, generate the new eligibility criteria by analyzing clinical trial information(### Clinical Trial Information).
|
|
|
|
| 385 |
- Drug: Amoxicillin hydrate
|
| 386 |
- Amoxicillin hydrate (potency)
|
| 387 |
|
|
|
|
|
|
|
|
|
|
| 388 |
- Biological: Pneumococcal Vaccine
|
| 389 |
- Subcutaneously on Day 0
|
| 390 |
- Other Names:
|
| 391 |
- Prevnar
|
| 392 |
+
|
| 393 |
- Drug: Doxorubicin, Cotrimoxazole, Carboplatin, Ifosfamide
|
| 394 |
|
| 395 |
- Drug: Irinotecan
|
|
|
|
| 401 |
- Placebo tablet
|
| 402 |
"""
|
| 403 |
|
|
|
|
|
|
|
| 404 |
with gr.Blocks() as demo:
|
| 405 |
|
| 406 |
with gr.Row():
|
|
|
|
| 418 |
gr.Markdown("# Research Information"),
|
| 419 |
with gr.Row():
|
| 420 |
study_obj_box = gr.Textbox(
|
| 421 |
+
label="Study Objective / Study Description",
|
|
|
|
| 422 |
placeholder=objective_place_holder,
|
| 423 |
lines=10)
|
| 424 |
# Conditions
|
|
|
|
| 496 |
with gr.Row():
|
| 497 |
ref_table = gr.Dataframe(
|
| 498 |
label="Reference",
|
| 499 |
+
headers=["No.",'Link', 'Study name', 'Intervention', 'Condition'],
|
| 500 |
datatype=["markdown","html","markdown", "markdown","markdown"],
|
| 501 |
wrap=True,
|
| 502 |
interactive=False)
|
|
|
|
| 561 |
clear_all_button.click(lambda : [None] * len(all_information), outputs=all_information)
|
| 562 |
|
| 563 |
if __name__ == "__main__":
|
| 564 |
+
demo.launch(debug=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|