Spaces:
Build error
Build error
Commit
β’
4f9ccf7
1
Parent(s):
a5fd1ec
set up git + initial gradio code
Browse files- .gitattributes +1 -0
- .gitignore +1 -0
- README.md +3 -3
- app.py +25 -0
- requirements.txt +1 -0
- sample_images/daniel_radcliffe-000001.jpeg +3 -0
- sample_images/daniel_radcliffe-000002.jpeg +3 -0
- sample_images/daniel_radcliffe-000003.jpeg +3 -0
- sample_images/daniel_radcliffe-000004.jpeg +3 -0
- sample_images/daniel_radcliffe-000202.jpeg +3 -0
- sample_images/daniel_radcliffe-000324.jpeg +3 -0
- sample_images/daniel_radcliffe-000360.jpeg +3 -0
- sample_images/daniel_radcliffe-000362.jpeg +3 -0
- sample_images/daniel_radcliffe-000381.jpeg +3 -0
- sample_images/daniel_radcliffe-000466.jpeg +3 -0
- sample_images/daniel_radcliffe-000504.jpeg +3 -0
- sample_images/dracoMalfoy-000002.jpeg +3 -0
- sample_images/dracoMalfoy-000003.jpeg +3 -0
- sample_images/ginnyweasly-000001.jpeg +3 -0
- sample_images/ginnyweasly-000002.jpeg +3 -0
- sample_images/ginnyweasly-000003.jpeg +3 -0
- sample_images/ginnyweasly-000139.jpeg +3 -0
- sample_images/ginnyweasly-000317.jpeg +3 -0
- sample_images/ginnyweasly-000328.jpeg +3 -0
- sample_images/ginnyweasly-000365.jpeg +3 -0
- sample_images/ginnyweasly-000388.jpeg +3 -0
- sample_images/ginnyweasly-000404.jpeg +3 -0
- sample_images/groupPhoto-000423.jpeg +3 -0
- sample_images/groupPhoto-000426.jpeg +3 -0
- sample_images/groupPhoto-000464.jpeg +3 -0
- sample_images/groupPhoto-000515.jpeg +3 -0
- sample_images/hermionie-000001.jpeg +3 -0
- sample_images/lunaLovegood-000001.jpeg +3 -0
- sample_images/lunaLovegood-000002.jpeg +3 -0
- sample_images/lunaLovegood-000003.jpeg +3 -0
.gitattributes
CHANGED
@@ -29,3 +29,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
29 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
30 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
31 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
29 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
30 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
31 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
32 |
+
*.jpeg filter=lfs diff=lfs merge=lfs -text
|
.gitignore
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
__pycache__
|
README.md
CHANGED
@@ -1,8 +1,8 @@
|
|
1 |
---
|
2 |
-
title: Harry Potter
|
3 |
-
emoji:
|
4 |
colorFrom: blue
|
5 |
-
colorTo:
|
6 |
sdk: gradio
|
7 |
sdk_version: 3.3.1
|
8 |
app_file: app.py
|
|
|
1 |
---
|
2 |
+
title: Harry Potter Actor Classifier
|
3 |
+
emoji: π
|
4 |
colorFrom: blue
|
5 |
+
colorTo: red
|
6 |
sdk: gradio
|
7 |
sdk_version: 3.3.1
|
8 |
app_file: app.py
|
app.py
ADDED
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from fastai.vision.all import *
|
2 |
+
import gradio as gr
|
3 |
+
|
4 |
+
title = "Harry Potter Character classifier"
|
5 |
+
description = "A Harry Potter Character classifier trained with over 3000 images from the internet!"
|
6 |
+
article = "<p style='text-align: center'><a href='https://aldrinjenson.me' target='_blank'>Created by Aldrin Jenson</a></p>"
|
7 |
+
examples = ['sample_images/daniel_radcliffe-000360.jpeg', 'sample_images/daniel_radcliffe-000003.jpeg', 'sample_images/daniel_radcliffe-000362.jpeg', 'sample_images/lunaLovegood-000003.jpeg', 'sample_images/groupPhoto-000426.jpeg', 'sample_images/daniel_radcliffe-000504.jpeg', 'sample_images/dracoMalfoy-000002.jpeg', 'sample_images/ginnyweasly-000365.jpeg', 'sample_images/daniel_radcliffe-000324.jpeg', 'sample_images/ginnyweasly-000328.jpeg', 'sample_images/hermionie-000001.jpeg', 'sample_images/ginnyweasly-000003.jpeg', 'sample_images/ginnyweasly-000404.jpeg', 'sample_images/lunaLovegood-000001.jpeg', 'sample_images/lunaLovegood-000002.jpeg',
|
8 |
+
'sample_images/dracoMalfoy-000003.jpeg', 'sample_images/daniel_radcliffe-000001.jpeg', 'sample_images/groupPhoto-000423.jpeg', 'sample_images/daniel_radcliffe-000004.jpeg', 'sample_images/daniel_radcliffe-000466.jpeg', 'sample_images/ginnyweasly-000002.jpeg', 'sample_images/daniel_radcliffe-000202.jpeg', 'sample_images/groupPhoto-000515.jpeg', 'sample_images/groupPhoto-000464.jpeg', 'sample_images/ginnyweasly-000317.jpeg', 'sample_images/ginnyweasly-000001.jpeg', 'sample_images/daniel_radcliffe-000381.jpeg', 'sample_images/ginnyweasly-000139.jpeg', 'sample_images/ginnyweasly-000388.jpeg', 'sample_images/daniel_radcliffe-000002.jpeg']
|
9 |
+
interpretation = 'default'
|
10 |
+
enable_queue = True
|
11 |
+
|
12 |
+
|
13 |
+
learn = load_learner('export.pkl')
|
14 |
+
labels = learn.dls.vocab
|
15 |
+
|
16 |
+
|
17 |
+
def predict(img):
|
18 |
+
img = PILImage.create(img)
|
19 |
+
pred, pred_idx, probs = learn.predict(img)
|
20 |
+
return {labels[i]: float(probs[i]) for i in range(len(labels))}
|
21 |
+
|
22 |
+
|
23 |
+
interface = gr.Interface(fn=predict, inputs=gr.components.Image(shape=(512, 512)), outputs=gr.components.Label(
|
24 |
+
num_top_classes=4), title=title, description=description, article=article, examples=examples, interpretation=interpretation)
|
25 |
+
interface.launch(share=True, enable_queue=enable_queue)
|
requirements.txt
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
fastai
|
sample_images/daniel_radcliffe-000001.jpeg
ADDED
![]() |
Git LFS Details
|
sample_images/daniel_radcliffe-000002.jpeg
ADDED
![]() |
Git LFS Details
|
sample_images/daniel_radcliffe-000003.jpeg
ADDED
![]() |
Git LFS Details
|
sample_images/daniel_radcliffe-000004.jpeg
ADDED
![]() |
Git LFS Details
|
sample_images/daniel_radcliffe-000202.jpeg
ADDED
![]() |
Git LFS Details
|
sample_images/daniel_radcliffe-000324.jpeg
ADDED
![]() |
Git LFS Details
|
sample_images/daniel_radcliffe-000360.jpeg
ADDED
![]() |
Git LFS Details
|
sample_images/daniel_radcliffe-000362.jpeg
ADDED
![]() |
Git LFS Details
|
sample_images/daniel_radcliffe-000381.jpeg
ADDED
![]() |
Git LFS Details
|
sample_images/daniel_radcliffe-000466.jpeg
ADDED
![]() |
Git LFS Details
|
sample_images/daniel_radcliffe-000504.jpeg
ADDED
![]() |
Git LFS Details
|
sample_images/dracoMalfoy-000002.jpeg
ADDED
![]() |
Git LFS Details
|
sample_images/dracoMalfoy-000003.jpeg
ADDED
![]() |
Git LFS Details
|
sample_images/ginnyweasly-000001.jpeg
ADDED
![]() |
Git LFS Details
|
sample_images/ginnyweasly-000002.jpeg
ADDED
![]() |
Git LFS Details
|
sample_images/ginnyweasly-000003.jpeg
ADDED
![]() |
Git LFS Details
|
sample_images/ginnyweasly-000139.jpeg
ADDED
![]() |
Git LFS Details
|
sample_images/ginnyweasly-000317.jpeg
ADDED
![]() |
Git LFS Details
|
sample_images/ginnyweasly-000328.jpeg
ADDED
![]() |
Git LFS Details
|
sample_images/ginnyweasly-000365.jpeg
ADDED
![]() |
Git LFS Details
|
sample_images/ginnyweasly-000388.jpeg
ADDED
![]() |
Git LFS Details
|
sample_images/ginnyweasly-000404.jpeg
ADDED
![]() |
Git LFS Details
|
sample_images/groupPhoto-000423.jpeg
ADDED
![]() |
Git LFS Details
|
sample_images/groupPhoto-000426.jpeg
ADDED
![]() |
Git LFS Details
|
sample_images/groupPhoto-000464.jpeg
ADDED
![]() |
Git LFS Details
|
sample_images/groupPhoto-000515.jpeg
ADDED
![]() |
Git LFS Details
|
sample_images/hermionie-000001.jpeg
ADDED
![]() |
Git LFS Details
|
sample_images/lunaLovegood-000001.jpeg
ADDED
![]() |
Git LFS Details
|
sample_images/lunaLovegood-000002.jpeg
ADDED
![]() |
Git LFS Details
|
sample_images/lunaLovegood-000003.jpeg
ADDED
![]() |
Git LFS Details
|