bhaskartripathi's picture
Update app.py
1e8edc1
raw
history blame
1.65 kB
import urllib.request
import fitz
import re
import numpy as np
import tensorflow_hub as hub
import openai
import gradio as gr
import os
from sklearn.neighbors import NearestNeighbors
title = 'MediDiagnostix AI'
description = """MediDiagnostix AI allows you to upload medical reports for analysis. Just click a picture of your medical report or upload a pdf report, it will
extract, analyze and provide you the medical interpretations of the report, potential diagnoses, and recommended follow-up actions. Furthermore, you can save diagnosis for future reference"""
with gr.Blocks(css="""#chatbot { font-size: 14px; min-height: 1200; }""") as demo:
gr.Markdown(f'<center><h3>{title}</h3></center>')
gr.Markdown(description)
with gr.Row():
with gr.Group():
gr.Markdown(f'<p style="text-align:center">Enter the number of reports to analyze</p>')
num_reports = gr.Number(label='Number of Reports', value=1)
with gr.Accordion("Upload Reports"):
file_upload = gr.File(label='Upload Reports (PDF/Image)', file_types=['.pdf', '.jpg', '.png'], interactive=True, type="file", allow_multiple=True)
analyze_button = gr.Button(value='Analyze Reports')
with gr.Group():
analysis_results = gr.Textbox(label='Analysis Results', placeholder="Results will appear here after analysis", lines=20)
analyze_button.click(
func=analyze_reports, # This function needs to be defined to handle the report analysis.
inputs=[file_upload, num_reports],
outputs=[analysis_results],
)
demo.launch()