Spaces:
Sleeping
Sleeping
njc-ai
commited on
Commit
•
d16e3d9
1
Parent(s):
1bdb9f5
First model upload and commit
Browse files- Birds of paradise plant oaxaca.jpg +0 -0
- Bougainvillea.jpg +0 -0
- Ceiba speciosa.jpg +0 -0
- Clavalina tree.jpg +0 -0
- Flamboyan.jpg +0 -0
- Flame vine.jpg +0 -0
- Jacaranda.jpg +0 -0
- Mexican creeper.jpg +0 -0
- Mislabeled.jpg +0 -0
- Plumeria rubra.jpg +0 -0
- Poinsettia tree.jpg +0 -0
- README.md +5 -6
- app.ipynb +0 -0
- app.py +42 -0
- mexicanPlants (1).pkl +3 -0
- mexicanPlants.pkl +3 -0
- primavera rosa.jpg +0 -0
- requirements.txt +5 -0
Birds of paradise plant oaxaca.jpg
ADDED
![]() |
Bougainvillea.jpg
ADDED
![]() |
Ceiba speciosa.jpg
ADDED
![]() |
Clavalina tree.jpg
ADDED
![]() |
Flamboyan.jpg
ADDED
![]() |
Flame vine.jpg
ADDED
![]() |
Jacaranda.jpg
ADDED
![]() |
Mexican creeper.jpg
ADDED
![]() |
Mislabeled.jpg
ADDED
![]() |
Plumeria rubra.jpg
ADDED
![]() |
Poinsettia tree.jpg
ADDED
![]() |
README.md
CHANGED
@@ -1,13 +1,12 @@
|
|
1 |
---
|
2 |
-
title:
|
3 |
-
emoji:
|
4 |
-
colorFrom:
|
5 |
-
colorTo:
|
6 |
sdk: gradio
|
7 |
-
sdk_version: 3.
|
8 |
app_file: app.py
|
9 |
pinned: false
|
10 |
-
license: apache-2.0
|
11 |
---
|
12 |
|
13 |
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
1 |
---
|
2 |
+
title: Potato Or Tomato
|
3 |
+
emoji: 💻
|
4 |
+
colorFrom: yellow
|
5 |
+
colorTo: purple
|
6 |
sdk: gradio
|
7 |
+
sdk_version: 3.9
|
8 |
app_file: app.py
|
9 |
pinned: false
|
|
|
10 |
---
|
11 |
|
12 |
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
app.ipynb
ADDED
The diff for this file is too large to render.
See raw diff
|
|
app.py
ADDED
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#|export
|
2 |
+
from fastai.vision.all import *
|
3 |
+
import os
|
4 |
+
import gradio as gr
|
5 |
+
def is_flower(x): return x[0].isupper()
|
6 |
+
|
7 |
+
#export
|
8 |
+
learn = load_learner('mexicanPlants (1).pkl')
|
9 |
+
|
10 |
+
|
11 |
+
#|export
|
12 |
+
categories = ('Jacaranda', 'Bougainvillea', 'Clavalina tree', 'Birds of paradise plant oaxaca', 'Flame vine', 'Plumeria rubra', 'Ceiba speciosa', 'Poinsettia tree', 'Calistemo', 'Flamboyan', 'Mexican creeper','primavera rosa')
|
13 |
+
|
14 |
+
def classify_image(img):
|
15 |
+
pred,idx,probs = learn.predict(img)
|
16 |
+
return dict(zip(categories,map(float,probs)))
|
17 |
+
|
18 |
+
|
19 |
+
# Get the current directory
|
20 |
+
current_dir = os.getcwd()
|
21 |
+
|
22 |
+
# Get a list of all files in the directory
|
23 |
+
all_files = os.listdir(current_dir)
|
24 |
+
|
25 |
+
# Create a list of categories
|
26 |
+
|
27 |
+
# Create an empty list to store the photos
|
28 |
+
photos = []
|
29 |
+
|
30 |
+
# Loop through all the files
|
31 |
+
for file in all_files:
|
32 |
+
# Check if the file is a photo
|
33 |
+
if file.endswith(('.jpg', '.jpeg', '.png', '.bmp', '.gif')):
|
34 |
+
# If it is, add it to the list of photos
|
35 |
+
photos.append(file)
|
36 |
+
|
37 |
+
image = gr.inputs.Image(shape=(192,192))
|
38 |
+
label = gr.outputs.Label()
|
39 |
+
examples = photos
|
40 |
+
|
41 |
+
intf = gr.Interface(fn=classify_image, inputs=image, outputs=label, examples=examples)
|
42 |
+
intf.launch(inline=False)
|
mexicanPlants (1).pkl
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:04cc7bab7e656394a4994072e0ca9bc5f60f244641c3b5629faa2fa0642fa50f
|
3 |
+
size 87501893
|
mexicanPlants.pkl
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:9f923a1f90c78142b4bded3f33c2a8ad6e81a379f8496720eabbe251f276482c
|
3 |
+
size 87501893
|
primavera rosa.jpg
ADDED
![]() |
requirements.txt
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
fastai
|
2 |
+
torch
|
3 |
+
gradio
|
4 |
+
numpy
|
5 |
+
pandas
|