baliddeki commited on
Commit
18a45f9
·
1 Parent(s): 8c6ba75
Files changed (1) hide show
  1. app.py +8 -16
app.py CHANGED
@@ -86,21 +86,13 @@ def predict(files):
86
  return class_name, report[0] if report else "No report generated."
87
 
88
  # Gradio Blocks (100% reliable approach)
89
- with gr.Blocks() as demo:
90
- gr.Markdown("# 🩺 Phronesis Medical Report Generator")
91
-
92
- upload_button = gr.UploadButton("Upload CT Scan Images", file_types=[".dcm", ".jpg", ".jpeg", ".png"], file_count="multiple")
93
- files_state = gr.State([])
94
-
95
- def store_files(new_files):
96
- return new_files
97
-
98
- upload_button.upload(store_files, upload_button, files_state)
99
-
100
- generate_btn = gr.Button("Generate Report")
101
- class_output = gr.Textbox(label="Predicted Class")
102
- report_output = gr.Textbox(label="Generated Report")
103
-
104
- generate_btn.click(predict, files_state, [class_output, report_output])
105
 
106
  demo.launch()
 
86
  return class_name, report[0] if report else "No report generated."
87
 
88
  # Gradio Blocks (100% reliable approach)
89
+ # Replace your Blocks interface with this simpler Interface approach
90
+ demo = gr.Interface(
91
+ fn=predict,
92
+ inputs=gr.File(file_count="multiple", file_types=[".dcm", ".jpg", ".jpeg", ".png"]),
93
+ outputs=[gr.Textbox(label="Predicted Class"), gr.Textbox(label="Generated Report")],
94
+ title="🩺 Phronesis Medical Report Generator",
95
+ description="Upload CT scan images to generate a medical report"
96
+ )
 
 
 
 
 
 
 
 
97
 
98
  demo.launch()