ashishkgpian's picture
Update app.py
4a02f51 verified
raw
history blame
5.49 kB
custom_css = """
.gradio-container {
width: 100% !important;
max-width: 100% !important;
margin: 0 !important;
padding: 0 !important;
min-height: 100vh !important;
display: flex !important;
flex-direction: column !important;
background-color: #000000 !important;
color: #ffffff !important;
}
.main-container {
text-align: center;
padding: 2rem;
margin: 0;
background: #000000;
width: 100%;
color: #ffffff;
}
.content-wrapper {
max-width: 1400px;
margin: 0 auto;
padding: 0 2rem;
width: 100%;
box-sizing: border-box;
background: #000000;
color: #ffffff;
}
.input-output-row {
display: flex !important;
gap: 2rem !important;
margin: 2rem 0 !important;
}
.input-container {
background: #1a1a1a !important;
padding: 1.5rem !important;
border-radius: 12px !important;
width: 50% !important;
flex: 1 !important;
display: flex !important;
flex-direction: column !important;
gap: 1rem !important;
}
.inner-input-container {
background: #262626 !important;
padding: 1.5rem !important;
border-radius: 8px !important;
display: flex !important;
flex-direction: column !important;
gap: 1rem !important;
}
.input-container label {
color: #ffffff !important;
font-weight: 500 !important;
font-size: 1rem !important;
margin-bottom: 0.5rem !important;
background: transparent !important;
}
textarea {
background: #262626 !important;
color: #ffffff !important;
border: 2px solid #7c4dff !important;
border-radius: 8px !important;
padding: 1rem !important;
font-size: 1rem !important;
min-height: 120px !important;
width: 100% !important;
resize: none !important;
}
.submit-btn {
background-color: #7c4dff !important;
color: white !important;
padding: 0.75rem !important;
border-radius: 8px !important;
font-size: 1rem !important;
margin-top: 0.5rem !important;
transition: all 0.3s ease !important;
width: 100% !important;
font-weight: 500 !important;
border: none !important;
}
.submit-btn:hover {
background-color: #6c3fff !important;
}
.output-container {
background: #1a1a1a !important;
padding: 1.5rem !important;
border-radius: 12px !important;
width: 50% !important;
flex: 1 !important;
color: #ffffff !important;
}
.output-container label {
color: #ffffff !important;
font-weight: 500 !important;
font-size: 1rem !important;
margin-bottom: 1rem !important;
background: transparent !important;
}
.examples-container {
background: #1a1a1a !important;
padding: 1.5rem !important;
border-radius: 12px !important;
margin: 2rem 0 !important;
width: 100% !important;
color: #ffffff !important;
}
.examples-container label {
color: #ffffff !important;
font-weight: 500 !important;
font-size: 1rem !important;
background: transparent !important;
}
.footer {
text-align: center;
padding: 2rem;
background: #000000;
margin-top: auto;
width: 100%;
border-top: 1px solid #333333;
color: #ffffff;
}
"""
with gr.Blocks(css=custom_css) as demo:
with gr.Row(elem_classes=["main-container"]):
with gr.Column(elem_classes=["content-wrapper"]):
with gr.Row(elem_classes=["input-output-row"]):
with gr.Column(elem_classes=["input-container"]):
gr.Markdown("Clinical Symptom Description")
with gr.Column(elem_classes=["inner-input-container"]):
input_text = gr.Textbox(
show_label=False,
placeholder="Enter detailed patient symptoms and clinical observations...",
lines=5
)
submit_btn = gr.Button("Analyze Symptoms", elem_classes=["submit-btn"])
with gr.Column(elem_classes=["output-container"]):
output = gr.JSON(
label="Suggested ICD9 Diagnostic Codes with Descriptions"
)
with gr.Row(elem_classes=["examples-container"]):
examples = gr.Examples(
examples=[
["45-year-old male experiencing severe chest pain, radiating to left arm, with shortness of breath and excessive sweating"],
["Persistent headache for 2 weeks, accompanied by dizziness and occasional blurred vision"],
["Diabetic patient reporting frequent urination, increased thirst, and unexplained weight loss"],
["Elderly patient with chronic knee pain, reduced mobility, and signs of inflammation"]
],
inputs=input_text,
label="Example Clinical Cases"
)
submit_btn.click(fn=classify_symptoms, inputs=input_text, outputs=output)
input_text.submit(fn=classify_symptoms, inputs=input_text, outputs=output)
with gr.Row(elem_classes=["footer"]):
gr.Markdown(
"""
⚕️ <strong>Medical Disclaimer:</strong> This AI tool is designed to assist medical professionals in ICD9 code classification.
Always verify suggestions with clinical judgment and consult appropriate medical resources.
"""
)
if __name__ == "__main__":
demo.launch(share=True)