Spaces:
Runtime error
Runtime error
ttcielott commited on
Commit ·
1ffa7fb
1
Parent(s): 11ac377
initial upload
Browse files- .DS_Store +0 -0
- app.py +29 -0
- dwight.jpeg +0 -0
- export.pkl +3 -0
- requirements.txt +2 -0
- stanley.jpg +0 -0
.DS_Store
ADDED
|
Binary file (6.15 kB). View file
|
|
|
app.py
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from fastcore.all import *
|
| 2 |
+
from fastai.vision.all import *
|
| 3 |
+
import gradio as gr
|
| 4 |
+
|
| 5 |
+
learn = load_leaner('export.pkl')
|
| 6 |
+
|
| 7 |
+
def predict(img):
|
| 8 |
+
img = PILImage.create(img)
|
| 9 |
+
ctr = learn.predict(img)[0]
|
| 10 |
+
|
| 11 |
+
img_resized = img.reshape(240, 320)
|
| 12 |
+
fig = plt.figure()
|
| 13 |
+
plt.imshow(img_resized)
|
| 14 |
+
plt.scatter(ctr[0][0], ctr[0][1], color = 'red')
|
| 15 |
+
plt.axis('off')
|
| 16 |
+
plt.show()
|
| 17 |
+
return fig
|
| 18 |
+
|
| 19 |
+
title = "Face Center"
|
| 20 |
+
description = "This model that is trained to find the center of faces in the uploaded picture."
|
| 21 |
+
|
| 22 |
+
gr.Interface(
|
| 23 |
+
fn=predict,
|
| 24 |
+
inputs='image',
|
| 25 |
+
outputs='plot',
|
| 26 |
+
title=title,
|
| 27 |
+
description=description,
|
| 28 |
+
# examples = ['scott.png','dwight.jpeg','stanley.jpg']
|
| 29 |
+
).launch(share=False)
|
dwight.jpeg
ADDED
|
export.pkl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:3cca063fb17d161499eb5e90dc31943e73216e62c2a71330bb3898c92b181cb8
|
| 3 |
+
size 87690725
|
requirements.txt
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
|
|
|
| 1 |
+
fastai
|
| 2 |
+
fastcore
|
stanley.jpg
ADDED
|