Spaces:
Runtime error
Runtime error
amit-asl
commited on
Commit
·
af138d9
1
Parent(s):
524fa48
init
Browse files- .gitignore +1 -0
- Dockerfile +11 -0
- app/croc.jpg +0 -0
- app/export.pkl +3 -0
- app/main.py +34 -0
- artifacts/reptile_weight_79.pth +3 -0
- reptile-classification.ipynb +0 -0
- requirements.txt +4 -0
.gitignore
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
venv
|
Dockerfile
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
FROM python:3.9
|
2 |
+
|
3 |
+
WORKDIR /code
|
4 |
+
|
5 |
+
COPY ./requirements.txt /code/requirements.txt
|
6 |
+
|
7 |
+
RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
|
8 |
+
|
9 |
+
COPY . .
|
10 |
+
|
11 |
+
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "7860"]
|
app/croc.jpg
ADDED
![]() |
app/export.pkl
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:ba47f0a8121f047aa472be188b050b9253aee0975b6900aacbc37b60eb37ef5e
|
3 |
+
size 161268396
|
app/main.py
ADDED
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
import tensorflow as tf
|
3 |
+
from PIL import Image
|
4 |
+
import numpy as np
|
5 |
+
from fastai.vision.all import *
|
6 |
+
|
7 |
+
def predict_image(image):
|
8 |
+
learner = learner_load('export.pkl')
|
9 |
+
img = PILImage.create(image)
|
10 |
+
pred = learner.predict(img)
|
11 |
+
return pred[0]
|
12 |
+
|
13 |
+
|
14 |
+
def create_interface():
|
15 |
+
|
16 |
+
image_input = gr.inputs.Image()
|
17 |
+
|
18 |
+
output = gr.outputs.Text()
|
19 |
+
|
20 |
+
iface = gr.Interface(
|
21 |
+
fn=predict_image,
|
22 |
+
inputs=image_input,
|
23 |
+
outputs=output,
|
24 |
+
capture_session=True,
|
25 |
+
title="Cat or Dog Classifier",
|
26 |
+
description="Upload an image to classify whether it's a cat or a dog."
|
27 |
+
)
|
28 |
+
return iface
|
29 |
+
|
30 |
+
if __name__ == "__main__":
|
31 |
+
iface = create_interface()
|
32 |
+
iface.launch()
|
33 |
+
|
34 |
+
|
artifacts/reptile_weight_79.pth
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:185a8ff6257f6ea0d02760a871ce9b2f38699c9b26cd54924333615002b183fe
|
3 |
+
size 481050613
|
reptile-classification.ipynb
ADDED
The diff for this file is too large to render.
See raw diff
|
|
requirements.txt
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
uvicorn
|
2 |
+
gradio
|
3 |
+
nicegui
|
4 |
+
fastai
|