muhammadsalmanalfaridzi commited on
Commit
e4e39d0
·
verified ·
1 Parent(s): 756b166

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -12
app.py CHANGED
@@ -56,25 +56,21 @@ def detect_objects(image):
56
  return "/tmp/prediction.jpg", result_text
57
 
58
  # Membuat antarmuka Gradio dengan label yang telah diganti
59
- iface = gr.Interface(
60
- fn=detect_objects, # Fungsi yang dipanggil saat gambar diupload
61
- inputs=gr.Image(type="pil", label="Input Image"), # Ganti label input
62
- outputs=[gr.Image(label="Detect Object"), gr.Textbox(label="Counting Object")], # Ganti label output
63
- live=True, # Menampilkan hasil secara langsung
64
- )
65
 
66
- # Membungkus input dan output dalam gr.Row() untuk layout berdampingan
67
  iface = gr.Interface(
68
  fn=detect_objects,
69
- inputs=gr.Image(type="pil", label="Input Image"), # Label input
70
- outputs=[gr.Image(label="Detect Object"), gr.Textbox(label="Counting Object")], # Label output
71
  live=True
72
  )
73
 
74
- # Membungkus input dan output dalam gr.Row() untuk layout berdampingan
75
  iface.layout = gr.Row(
76
- gr.Column(iface.inputs), # Input image component
77
- gr.Column(iface.outputs) # Output components (image and text)
78
  )
79
 
80
  # Menjalankan antarmuka
 
56
  return "/tmp/prediction.jpg", result_text
57
 
58
  # Membuat antarmuka Gradio dengan label yang telah diganti
59
+ inputs = gr.Image(type="pil", label="Input Image") # Label input
60
+ outputs = [gr.Image(label="Detect Object"), gr.Textbox(label="Counting Object")] # Label output
 
 
 
 
61
 
62
+ # Membuat layout dengan gr.Row() untuk menampilkan input dan output berdampingan
63
  iface = gr.Interface(
64
  fn=detect_objects,
65
+ inputs=inputs,
66
+ outputs=outputs,
67
  live=True
68
  )
69
 
70
+ # Menyusun antarmuka dengan layout horizontal
71
  iface.layout = gr.Row(
72
+ inputs, # Input image component
73
+ outputs # Output components (image and text)
74
  )
75
 
76
  # Menjalankan antarmuka