Files changed (1) hide show
  1. app.py +6 -4
app.py CHANGED
@@ -5,7 +5,7 @@ from PIL import Image
5
  import io
6
  import sys
7
  import gradio as gr
8
- from tensorflow.keras.applications.densenet import preprocess_input
9
 
10
  # =========================
11
  # 1. FastAPI Init
@@ -17,7 +17,7 @@ app = FastAPI(title="Ashoka Buried Penis Classifier API")
17
  # =========================
18
  print("Loading model...")
19
  try:
20
- model = tf.keras.models.load_model("cnn_kfold_best_model_v2.h5")
21
  print("Model loaded successfully")
22
  except Exception as e:
23
  print("Failed to load model:", e)
@@ -56,6 +56,8 @@ def predict_image(image):
56
  # =========================
57
  # 5. FastAPI Endpoint
58
  # =========================
 
 
59
  @app.post("/predict")
60
  async def api_predict(file: UploadFile = File(...)):
61
  image_bytes = await file.read()
@@ -75,7 +77,7 @@ async def api_predict(file: UploadFile = File(...)):
75
  # =========================
76
  with gr.Blocks() as demo:
77
  gr.Markdown("""
78
- # Ashoka Hipospadia Classifier API - DenseNet
79
  **Medical screening tool for Buried Penis**
80
 
81
  ⚠️ This tool is **NOT a diagnostic device**.
@@ -103,4 +105,4 @@ with gr.Blocks() as demo:
103
  # =========================
104
  # 7. Mount Gradio to FastAPI
105
  # =========================
106
- app = gr.mount_gradio_app(app, demo, path="/")
 
5
  import io
6
  import sys
7
  import gradio as gr
8
+ from tensorflow.keras.applications.resnet50 import preprocess_input
9
 
10
  # =========================
11
  # 1. FastAPI Init
 
17
  # =========================
18
  print("Loading model...")
19
  try:
20
+ model = tf.keras.models.load_model("cnn_kfold_best_model.h5")
21
  print("Model loaded successfully")
22
  except Exception as e:
23
  print("Failed to load model:", e)
 
56
  # =========================
57
  # 5. FastAPI Endpoint
58
  # =========================
59
+
60
+
61
  @app.post("/predict")
62
  async def api_predict(file: UploadFile = File(...)):
63
  image_bytes = await file.read()
 
77
  # =========================
78
  with gr.Blocks() as demo:
79
  gr.Markdown("""
80
+ # Ashoka Hipospadia Classifier API - ResNet50
81
  **Medical screening tool for Buried Penis**
82
 
83
  ⚠️ This tool is **NOT a diagnostic device**.
 
105
  # =========================
106
  # 7. Mount Gradio to FastAPI
107
  # =========================
108
+ app = gr.mount_gradio_app(app, demo, path="/")