MetaQu commited on
Commit
269f417
·
verified ·
1 Parent(s): 21b75c4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -10
app.py CHANGED
@@ -40,7 +40,7 @@ def has_camera_exif(image):
40
  # ----------------------------
41
  # DETEKSI HYBRID
42
  # ----------------------------
43
- def detect_image(image):
44
  output_lines = []
45
 
46
  hf_score = 0
@@ -92,15 +92,17 @@ def detect_image(image):
92
  return "\n".join(output_lines)
93
 
94
  # ----------------------------
95
- # Gradio Interface
96
  # ----------------------------
97
- iface = gr.Interface(
98
- fn=detect_image,
99
- inputs=gr.Image(type="pil"),
100
- outputs="markdown",
101
- title="AI vs Foto Asli Detector (Versi Akurat)",
102
- description="Unggah gambar, sistem akan mendeteksi apakah gambar kemungkinan besar asli atau dihasilkan AI."
103
- )
 
 
104
 
105
  if __name__ == "__main__":
106
- iface.launch()
 
40
  # ----------------------------
41
  # DETEKSI HYBRID
42
  # ----------------------------
43
+ def detect_image(image: Image.Image):
44
  output_lines = []
45
 
46
  hf_score = 0
 
92
  return "\n".join(output_lines)
93
 
94
  # ----------------------------
95
+ # Gradio Interface (5.x syntax)
96
  # ----------------------------
97
+ with gr.Blocks(title="AI vs Foto Asli Detector (Versi Akurat)") as demo:
98
+ gr.Markdown("Unggah gambar, sistem akan mendeteksi apakah gambar kemungkinan besar asli atau dihasilkan AI.")
99
+
100
+ with gr.Row():
101
+ img_input = gr.Image(type="pil", label="Unggah Gambar")
102
+ output_md = gr.Markdown(label="Hasil Deteksi")
103
+
104
+ detect_btn = gr.Button("Deteksi")
105
+ detect_btn.click(fn=detect_image, inputs=img_input, outputs=output_md)
106
 
107
  if __name__ == "__main__":
108
+ demo.launch()