kendrickfff commited on
Commit
f71dbd2
·
verified ·
1 Parent(s): 2ddee8d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -12
app.py CHANGED
@@ -12,6 +12,8 @@ import subprocess
12
  import zipfile
13
  from PIL import Image
14
  import gradio as gr
 
 
15
 
16
  # Setup Kaggle API
17
  kaggle_dir = os.path.expanduser("~/.kaggle")
@@ -85,18 +87,18 @@ class_names = ['battery', 'biological', 'brown-glass', 'cardboard',
85
 
86
  # Define bin colors and image paths
87
  bin_info = {
88
- 'battery': ('Merah (Red)', '/main/red_bin.png'),
89
- 'biological': ('Hijau (Green)', '/main/green_bin.png'),
90
- 'brown-glass': ('Kuning (Yellow)', '/main/yellow_bin.png'),
91
- 'cardboard': ('Biru (Blue)', '/main/blue_bin.png'),
92
- 'clothes': ('Kuning (Yellow)', '/main/yellow_bin.png'),
93
- 'green-glass': ('Kuning (Yellow)', '/main/yellow_bin.png'),
94
- 'metal': ('Kuning (Yellow)', '/main/yellow_bin.png'),
95
- 'paper': ('Biru (Blue)', '/main/blue_bin.png'),
96
- 'plastic': ('Kuning (Yellow)', '/main/yellow_bin.png'),
97
- 'shoes': ('Kuning (Yellow)', '/main/yellow_bin.png'),
98
- 'trash': ('Abu-abu (Gray)', '/main/gray_bin.png'),
99
- 'white-glass': ('Kuning (Yellow)', '/main/yellow_bin.png')
100
  }
101
 
102
  # Define the prediction function
 
12
  import zipfile
13
  from PIL import Image
14
  import gradio as gr
15
+ import requests
16
+ from io import BytesIO
17
 
18
  # Setup Kaggle API
19
  kaggle_dir = os.path.expanduser("~/.kaggle")
 
87
 
88
  # Define bin colors and image paths
89
  bin_info = {
90
+ 'battery': ('Merah (Red)', 'https://huggingface.co/spaces/kendrickfff/resnet50_garbage_classification_v1.2/resolve/main/red_bin.png'),
91
+ 'biological': ('Hijau (Green)', 'https://huggingface.co/spaces/kendrickfff/resnet50_garbage_classification_v1.2/resolve/main/green_bin.png'),
92
+ 'brown-glass': ('Kuning (Yellow)', 'https://huggingface.co/spaces/kendrickfff/resnet50_garbage_classification_v1.2/resolve/main/yellow_bin.png'),
93
+ 'cardboard': ('Biru (Blue)', 'https://huggingface.co/spaces/kendrickfff/resnet50_garbage_classification_v1.2/resolve/main/blue_bin.png'),
94
+ 'clothes': ('Kuning (Yellow)', 'https://huggingface.co/spaces/kendrickfff/resnet50_garbage_classification_v1.2/resolve/main/yellow_bin.png'),
95
+ 'green-glass': ('Kuning (Yellow)', 'https://huggingface.co/spaces/kendrickfff/resnet50_garbage_classification_v1.2/resolve/main/yellow_bin.png'),
96
+ 'metal': ('Kuning (Yellow)', 'https://huggingface.co/spaces/kendrickfff/resnet50_garbage_classification_v1.2/resolve/main/yellow_bin.png'),
97
+ 'paper': ('Biru (Blue)', 'https://huggingface.co/spaces/kendrickfff/resnet50_garbage_classification_v1.2/resolve/main/blue_bin.png'),
98
+ 'plastic': ('Kuning (Yellow)', 'https://huggingface.co/spaces/kendrickfff/resnet50_garbage_classification_v1.2/resolve/main/yellow_bin.png'),
99
+ 'shoes': ('Kuning (Yellow)', 'https://huggingface.co/spaces/kendrickfff/resnet50_garbage_classification_v1.2/resolve/main/yellow_bin.png'),
100
+ 'trash': ('Abu-abu (Gray)', 'https://huggingface.co/spaces/kendrickfff/resnet50_garbage_classification_v1.2/resolve/main/gray_bin.png'),
101
+ 'white-glass': ('Kuning (Yellow)', 'https://huggingface.co/spaces/kendrickfff/resnet50_garbage_classification_v1.2/resolve/main/yellow_bin.png')
102
  }
103
 
104
  # Define the prediction function