Skip to content

Commit

Permalink
get back to huggingfacce-hub
Browse files Browse the repository at this point in the history
  • Loading branch information
CuriousDima committed Jul 1, 2024
1 parent 5fc6cd1 commit d8e0888
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 135 deletions.
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
from copy import deepcopy

from fastai.vision.all import *

# from huggingface_hub import from_pretrained_fastai
from huggingface_hub import from_pretrained_fastai
from PIL import Image

# from streamlit_js_eval import get_page_location
import pandas as pd
import streamlit as st
import pathlib


_LABELS = (
Expand Down Expand Up @@ -141,9 +137,7 @@ def get_breed(path):

@st.cache_resource
def get_predictor():
# return from_pretrained_fastai("TheDima/resnet50-dog-breed-identification")
path = pathlib.Path("dog-breed-identification-export_error-rate-0_118.pkl")
return load_learner(path)
return from_pretrained_fastai("TheDima/resnet50-dog-breed-identification")


def predict(image):
Expand All @@ -161,19 +155,16 @@ def print_probabilities(probs, labels, top_n=10):

st.title("Dog Breed Recognition")

# url = get_page_location()
# image_prefix = url["protocol"] + "//" + url["host"]

# st.write("Some doggies for your inspiration")
# d1, d2, d3, d4 = st.columns(4)
# with d1:
# st.image("static/0a54ce47525781f2caa66f65291dddf8.jpg")
# with d2:
# st.image("static/0a59d3205cff15e31ee30213b9988e7e.jpg")
# with d3:
# st.image("static/0ab808aa3571846e50ed74a204662c52.jpg")
# with d4:
# st.image("static/0c0b3758c1b177b2a2961c1483159898.jpg")
st.write("Some doggies for your inspiration")
d1, d2, d3, d4 = st.columns(4)
with d1:
st.image("static/0a54ce47525781f2caa66f65291dddf8.jpg")
with d2:
st.image("static/0a59d3205cff15e31ee30213b9988e7e.jpg")
with d3:
st.image("static/0ab808aa3571846e50ed74a204662c52.jpg")
with d4:
st.image("static/0c0b3758c1b177b2a2961c1483159898.jpg")


uploaded_file = st.file_uploader("Upload a doggy...", type=["jpg", "jpeg"])
Expand Down
114 changes: 0 additions & 114 deletions deep-learning/fastai-2-cv-train-and-deploy/requirements.txt

This file was deleted.

2 changes: 2 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ fonttools==4.53.0
fsspec==2024.6.1
gitdb==4.0.11
GitPython==3.1.43
huggingface-hub==0.23.4
idna==3.7
ipykernel==6.29.4
ipython==8.23.0
Expand Down Expand Up @@ -91,6 +92,7 @@ spacy-loggers==1.0.5
srsly==2.4.8
stack-data==0.6.3
streamlit==1.36.0
streamlit-js-eval==0.1.7
sympy==1.12.1
tenacity==8.4.2
thinc==8.2.5
Expand Down

0 comments on commit d8e0888

Please sign in to comment.