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'
Enter the number of reports to analyze
') 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()