DimasMP3 commited on
Commit
8343674
·
1 Parent(s): b02d758
Files changed (1) hide show
  1. app.py +11 -11
app.py CHANGED
@@ -1,15 +1,13 @@
1
- # app.py (potongan penting saja)
2
-
3
- import os
4
  import gradio as gr
5
- from inference import predict, predict_batch
6
 
7
  APP_TITLE = "# Face Shape Classification — EfficientNetB4 (300×300)"
8
  APP_DESC = """
9
- **Model:** EfficientNetB4 (ImageNet) fine-tuned pada 5 kelas: **Heart, Oblong, Oval, Round, Square**.
10
- **Val Acc (best): ~96%** · **Input:** Foto wajah **frontal** RGB (1 orang), auto-resize **300×300**.
11
- **Output:** Prediksi + confidence (Top-5).
12
- **Disclaimer:** Untuk penelitian/edukasi.
 
13
  """
14
 
15
  with gr.Blocks(theme=gr.themes.Soft()) as demo:
@@ -24,13 +22,15 @@ with gr.Blocks(theme=gr.themes.Soft()) as demo:
24
  btn = gr.Button("Predict", variant="primary")
25
  gr.ClearButton([inp, out])
26
 
27
- btn.click(predict, inputs=inp, outputs=out)
 
28
 
29
  with gr.Tab("Batch (optional)"):
30
- gal = gr.Gallery(label="Images", columns=4, height="auto")
31
  out_gal = gr.JSON(label="Batch outputs")
32
  runb = gr.Button("Run batch")
33
- runb.click(predict_batch, inputs=gal, outputs=out_gal)
34
 
35
  if __name__ == "__main__":
36
  demo.launch()
 
 
 
 
 
1
  import gradio as gr
2
+ from inference import predict, predict_batch
3
 
4
  APP_TITLE = "# Face Shape Classification — EfficientNetB4 (300×300)"
5
  APP_DESC = """
6
+ Model EfficientNetB4 (ImageNet) fine-tuned pada 5 kelas: Heart, Oblong, Oval, Round, Square.
7
+
8
+ • Input: Foto wajah frontal RGB (1 orang), auto-resize 300×300.
9
+ • Output: Prediksi + confidence (Top-5).
10
+ • Disclaimer: Untuk penelitian/edukasi.
11
  """
12
 
13
  with gr.Blocks(theme=gr.themes.Soft()) as demo:
 
22
  btn = gr.Button("Predict", variant="primary")
23
  gr.ClearButton([inp, out])
24
 
25
+ # Expose stable API names for @gradio/client consumers
26
+ btn.click(predict, inputs=inp, outputs=out, api_name="predict")
27
 
28
  with gr.Tab("Batch (optional)"):
29
+ gal = gr.Gallery(label="Images", columns=4, height="auto")
30
  out_gal = gr.JSON(label="Batch outputs")
31
  runb = gr.Button("Run batch")
32
+ runb.click(predict_batch, inputs=gal, outputs=out_gal, api_name="predict_batch")
33
 
34
  if __name__ == "__main__":
35
  demo.launch()
36
+