| import gradio as gr | |
| from model import ChestGPTDemo | |
| model = ChestGPTDemo() | |
| def analyze(image): | |
| return model.predict(image) | |
| with gr.Blocks() as demo: | |
| gr.Markdown("## 🩺 ChestGPT - Chest X-Ray Diagnosis Assistant") | |
| gr.Markdown("Upload a chest X-ray image or try an example.") | |
| image_input = gr.Image(type="pil", label="Chest X-Ray Input") | |
| output_text = gr.Textbox(label="Diagnosis Output") | |
| analyze_button = gr.Button("Analyze") | |
| analyze_button.click(fn=analyze, inputs=image_input, outputs=output_text) | |
| gr.Examples( | |
| examples=["example_images/sample1.png"], | |
| inputs=image_input | |
| ) | |
| demo.queue().launch() | |