iamsuman commited on
Commit
35cc57d
·
1 Parent(s): 9c4be5d

update with better model support

Browse files
.gitignore CHANGED
@@ -6,4 +6,5 @@ flagged/
6
  *.mkv
7
  .DS_Store
8
  gradio_cached_examples/
9
- venv/
 
 
6
  *.mkv
7
  .DS_Store
8
  gradio_cached_examples/
9
+ venv/
10
+ __pycache__
README.md CHANGED
@@ -1,6 +1,6 @@
1
  ---
2
- title: Ripe And Unripe Tomatoes Detection
3
- emoji: 🍅
4
  colorFrom: green
5
  colorTo: yellow
6
  sdk: gradio
 
1
  ---
2
+ title: Waste Detection
3
+ emoji: 🗑️
4
  colorFrom: green
5
  colorTo: yellow
6
  sdk: gradio
app.py CHANGED
@@ -13,21 +13,29 @@ class_colors = {cls: (random.randint(0, 255), random.randint(0, 255), random.ran
13
 
14
  # File URLs for sample images and video
15
  file_urls = [
16
- 'https://huggingface.co/spaces/iamsuman/waste-detection/resolve/main/samples/AluCan1%2C000.jpg',
17
- 'https://huggingface.co/spaces/iamsuman/waste-detection/resolve/main/samples/Glass847.jpg',
18
- 'https://huggingface.co/spaces/iamsuman/waste-detection/resolve/main/samples/sample_waste.mp4',
19
  ]
20
 
21
- # Function to download files
22
  def download_file(url, save_name):
23
- if not os.path.exists(save_name):
24
- file = requests.get(url)
25
- open(save_name, 'wb').write(file.content)
 
 
 
 
 
 
 
26
 
27
  # Download images and video
28
  for i, url in enumerate(file_urls):
 
29
  if 'mp4' in file_urls[i]:
30
- download_file(file_urls[i], "video.mp4")
31
  else:
32
  download_file(file_urls[i], f"image_{i}.jpg")
33
 
 
13
 
14
  # File URLs for sample images and video
15
  file_urls = [
16
+ 'https://huggingface.co/spaces/iamsuman/waste-detection/resolve/main/samples/AluCan1%2C000.jpg?download=true',
17
+ 'https://huggingface.co/spaces/iamsuman/waste-detection/resolve/main/samples/Glass847.jpg?download=true',
18
+ 'https://huggingface.co/spaces/iamsuman/waste-detection/resolve/main/samples/sample_waste.mp4?download=true',
19
  ]
20
 
21
+ # Function to download files (always overwrites existing ones)
22
  def download_file(url, save_name):
23
+ print(f"Downloading from: {url}") # Log the URL
24
+ try:
25
+ response = requests.get(url, stream=True)
26
+ response.raise_for_status() # Check for HTTP errors
27
+ with open(save_name, 'wb') as file:
28
+ for chunk in response.iter_content(1024):
29
+ file.write(chunk)
30
+ print(f"Downloaded and overwritten: {save_name}")
31
+ except requests.exceptions.RequestException as e:
32
+ print(f"Error downloading {url}: {e}")
33
 
34
  # Download images and video
35
  for i, url in enumerate(file_urls):
36
+ print(i, url)
37
  if 'mp4' in file_urls[i]:
38
+ download_file(file_urls[i], f"video.mp4")
39
  else:
40
  download_file(file_urls[i], f"image_{i}.jpg")
41
 
best.pt CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:dd309b6c4ad5c32e348aa4187ec03e4c558b50099caf846fb4f21b21b85c4228
3
- size 6243235
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c6b887e7a54f4dda0ac67bbe0efcf30edf25b3cd356ffa97f58e289427b22d4c
3
+ size 6233059
samples/riped_tomato_93.jpeg DELETED
Binary file (113 kB)
 
samples/riped_tomato_94.jpeg DELETED
Binary file (68.1 kB)
 
samples/tomatoes.mp4 DELETED
@@ -1,3 +0,0 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:605d5fb1a532865bd93c5cc08d92b9804d8987f6aedc66c88e9ca32ad9932fc1
3
- size 2537426
 
 
 
 
samples/unriped_tomato_1.jpeg DELETED
Binary file (665 kB)
 
samples/unriped_tomato_18.jpeg DELETED
Binary file (60.1 kB)
 
samples/unriped_tomato_7.jpeg DELETED
Binary file (237 kB)