fix: remove broken models, add timm and huggingface_hub deps, add token login for gated repos
Browse files- app.py +5 -17
- requirements.txt +3 -1
app.py
CHANGED
|
@@ -2,24 +2,26 @@ import streamlit as st
|
|
| 2 |
from transformers import pipeline
|
| 3 |
from PIL import Image
|
| 4 |
import pandas as pd
|
|
|
|
| 5 |
|
| 6 |
MIN_ACEPTABLE_SCORE = 0.1
|
| 7 |
MAX_N_LABELS = 5
|
| 8 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
MODELS = [
|
| 10 |
("google/vit-base-patch16-224", "General Image Classification"),
|
| 11 |
("microsoft/resnet-50", "General Image Classification"),
|
| 12 |
("microsoft/resnet-18", "General Image Classification"),
|
| 13 |
("microsoft/resnet-34", "General Image Classification"),
|
| 14 |
("microsoft/resnet-101", "General Image Classification"),
|
| 15 |
-
("microsoft/resnet-152", "General Image Classification"),
|
| 16 |
("microsoft/swin-tiny-patch4-window7-224", "General Image Classification"),
|
| 17 |
("microsoft/swinv2-base-patch4-window16-256", "General Image Classification"),
|
| 18 |
-
("microsoft/beit-base-patch16-224-pt22k-ft22k", "General Image Classification"),
|
| 19 |
("facebook/convnext-large-224", "General Image Classification"),
|
| 20 |
("facebook/convnext-base-224-22k-1k", "General Image Classification"),
|
| 21 |
("facebook/convnext-tiny-224", "General Image Classification"),
|
| 22 |
-
("nvidia/mit-b0", "General Image Classification"),
|
| 23 |
("timm/resnet50.a1_in1k", "General Image Classification"),
|
| 24 |
("timm/tf_efficientnetv2_s.in21k", "General Image Classification"),
|
| 25 |
("timm/convnext_tiny.fb_in22k", "General Image Classification"),
|
|
@@ -30,38 +32,24 @@ MODELS = [
|
|
| 30 |
("nateraw/vit-age-classifier", "Age Classification"),
|
| 31 |
|
| 32 |
("Falconsai/nsfw_image_detection", "NSFW Detection"),
|
| 33 |
-
("LukeJacob2023/nsfw-image-detector", "NSFW Detection"),
|
| 34 |
("carbon225/vit-base-patch16-224-hentai", "NSFW Detection"),
|
| 35 |
("Marqo/nsfw-image-detection-384", "NSFW Detection"),
|
| 36 |
|
| 37 |
("cafeai/cafe_aesthetic", "Aesthetic/Art Classification"),
|
| 38 |
-
("shadowlilac/aesthetic-shadow", "Aesthetic/Art Classification"),
|
| 39 |
-
("pixai-labs/pixai-tagger-v0.9", "Aesthetic/Art Classification"),
|
| 40 |
|
| 41 |
("trpakov/vit-face-expression", "Face/Emotion Classification"),
|
| 42 |
("RickyIG/emotion_face_image_classification", "Face/Emotion Classification"),
|
| 43 |
("rizvandwiki/gender-classification", "Face/Emotion Classification"),
|
| 44 |
|
| 45 |
-
("nateraw/food", "Food Classification"),
|
| 46 |
-
("BinhQuocNguyen/food-recognition-model", "Food Classification"),
|
| 47 |
-
|
| 48 |
-
("google/derm-foundation", "Medical/Dermatology"),
|
| 49 |
-
("google/cxr-foundation", "Medical/Dermatology"),
|
| 50 |
("Anwarkh1/Skin_Cancer-Image_Classification", "Medical/Dermatology"),
|
| 51 |
|
| 52 |
("Ateeqq/ai-vs-human-image-detector", "AI vs Human Detection"),
|
| 53 |
("umm-maybe/AI-image-detector", "AI vs Human Detection"),
|
| 54 |
|
| 55 |
-
("not-lain/deepfake", "Deepfake Detection"),
|
| 56 |
-
|
| 57 |
("DunnBC22/vit-base-patch16-224-in21k_Human_Activity_Recognition", "Human Activity Recognition"),
|
| 58 |
|
| 59 |
-
("aalonso-developer/vit-base-patch16-224-in21k-clothing-classifier", "Clothing/Fashion"),
|
| 60 |
-
|
| 61 |
("andupets/real-estate-image-classification", "Real Estate"),
|
| 62 |
|
| 63 |
-
("FatihC/swin-tiny-patch4-window7-224-finetuned-eurosat-watermark", "Satellite/Remote Sensing"),
|
| 64 |
-
|
| 65 |
("lamnt2008/car_brands_classification", "Car Classification"),
|
| 66 |
|
| 67 |
("docling-project/DocumentFigureClassifier-v2.5", "Document Classification"),
|
|
|
|
| 2 |
from transformers import pipeline
|
| 3 |
from PIL import Image
|
| 4 |
import pandas as pd
|
| 5 |
+
from huggingface_hub import login
|
| 6 |
|
| 7 |
MIN_ACEPTABLE_SCORE = 0.1
|
| 8 |
MAX_N_LABELS = 5
|
| 9 |
|
| 10 |
+
HF_TOKEN = st.secrets.get("HF_TOKEN") if hasattr(st, "secrets") else None
|
| 11 |
+
if HF_TOKEN:
|
| 12 |
+
login(token=HF_TOKEN)
|
| 13 |
+
|
| 14 |
MODELS = [
|
| 15 |
("google/vit-base-patch16-224", "General Image Classification"),
|
| 16 |
("microsoft/resnet-50", "General Image Classification"),
|
| 17 |
("microsoft/resnet-18", "General Image Classification"),
|
| 18 |
("microsoft/resnet-34", "General Image Classification"),
|
| 19 |
("microsoft/resnet-101", "General Image Classification"),
|
|
|
|
| 20 |
("microsoft/swin-tiny-patch4-window7-224", "General Image Classification"),
|
| 21 |
("microsoft/swinv2-base-patch4-window16-256", "General Image Classification"),
|
|
|
|
| 22 |
("facebook/convnext-large-224", "General Image Classification"),
|
| 23 |
("facebook/convnext-base-224-22k-1k", "General Image Classification"),
|
| 24 |
("facebook/convnext-tiny-224", "General Image Classification"),
|
|
|
|
| 25 |
("timm/resnet50.a1_in1k", "General Image Classification"),
|
| 26 |
("timm/tf_efficientnetv2_s.in21k", "General Image Classification"),
|
| 27 |
("timm/convnext_tiny.fb_in22k", "General Image Classification"),
|
|
|
|
| 32 |
("nateraw/vit-age-classifier", "Age Classification"),
|
| 33 |
|
| 34 |
("Falconsai/nsfw_image_detection", "NSFW Detection"),
|
|
|
|
| 35 |
("carbon225/vit-base-patch16-224-hentai", "NSFW Detection"),
|
| 36 |
("Marqo/nsfw-image-detection-384", "NSFW Detection"),
|
| 37 |
|
| 38 |
("cafeai/cafe_aesthetic", "Aesthetic/Art Classification"),
|
|
|
|
|
|
|
| 39 |
|
| 40 |
("trpakov/vit-face-expression", "Face/Emotion Classification"),
|
| 41 |
("RickyIG/emotion_face_image_classification", "Face/Emotion Classification"),
|
| 42 |
("rizvandwiki/gender-classification", "Face/Emotion Classification"),
|
| 43 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 44 |
("Anwarkh1/Skin_Cancer-Image_Classification", "Medical/Dermatology"),
|
| 45 |
|
| 46 |
("Ateeqq/ai-vs-human-image-detector", "AI vs Human Detection"),
|
| 47 |
("umm-maybe/AI-image-detector", "AI vs Human Detection"),
|
| 48 |
|
|
|
|
|
|
|
| 49 |
("DunnBC22/vit-base-patch16-224-in21k_Human_Activity_Recognition", "Human Activity Recognition"),
|
| 50 |
|
|
|
|
|
|
|
| 51 |
("andupets/real-estate-image-classification", "Real Estate"),
|
| 52 |
|
|
|
|
|
|
|
| 53 |
("lamnt2008/car_brands_classification", "Car Classification"),
|
| 54 |
|
| 55 |
("docling-project/DocumentFigureClassifier-v2.5", "Document Classification"),
|
requirements.txt
CHANGED
|
@@ -1,3 +1,5 @@
|
|
| 1 |
streamlit
|
| 2 |
torch
|
| 3 |
-
transformers
|
|
|
|
|
|
|
|
|
| 1 |
streamlit
|
| 2 |
torch
|
| 3 |
+
transformers
|
| 4 |
+
timm
|
| 5 |
+
huggingface_hub
|