Spaces:
Runtime error
Runtime error
upload v1664846447 model
Browse files
README.md
CHANGED
@@ -1,8 +1,7 @@
|
|
1 |
---
|
2 |
title: "test"
|
3 |
-
description: "test"
|
4 |
sdk: "gradio"
|
5 |
app_file: app.py
|
6 |
tags: ["tfx", "auto-generated"]
|
7 |
pinned: false
|
8 |
-
---
|
|
|
1 |
---
|
2 |
title: "test"
|
|
|
3 |
sdk: "gradio"
|
4 |
app_file: app.py
|
5 |
tags: ["tfx", "auto-generated"]
|
6 |
pinned: false
|
7 |
+
---
|
app.py
CHANGED
@@ -8,9 +8,9 @@ from huggingface_hub import from_pretrained_keras
|
|
8 |
PRETRAIN_CHECKPOINT = "google/vit-base-patch16-224-in21k"
|
9 |
feature_extractor = ViTFeatureExtractor.from_pretrained(PRETRAIN_CHECKPOINT)
|
10 |
|
11 |
-
#
|
12 |
-
#
|
13 |
-
MODEL_CKPT = "
|
14 |
MODEL = from_pretrained_keras(MODEL_CKPT)
|
15 |
|
16 |
RESOLTUION = 224
|
@@ -51,12 +51,8 @@ def get_predictions(image: Image) -> tf.Tensor:
|
|
51 |
|
52 |
confidences = {labels[i]: float(probs[0][i]) for i in range(3)}
|
53 |
return confidences
|
54 |
-
|
55 |
-
title = "Simple demo for a Image Classification of the Beans Dataset with HF ViT model"
|
56 |
-
|
57 |
-
description = """
|
58 |
|
59 |
-
""
|
60 |
|
61 |
demo = gr.Interface(
|
62 |
get_predictions,
|
@@ -66,4 +62,4 @@ demo = gr.Interface(
|
|
66 |
title=title,
|
67 |
)
|
68 |
|
69 |
-
demo.launch(debug=True)
|
|
|
8 |
PRETRAIN_CHECKPOINT = "google/vit-base-patch16-224-in21k"
|
9 |
feature_extractor = ViTFeatureExtractor.from_pretrained(PRETRAIN_CHECKPOINT)
|
10 |
|
11 |
+
# test_model should be like chansung/test-vit
|
12 |
+
# test_version
|
13 |
+
MODEL_CKPT = "test_model@test_version"
|
14 |
MODEL = from_pretrained_keras(MODEL_CKPT)
|
15 |
|
16 |
RESOLTUION = 224
|
|
|
51 |
|
52 |
confidences = {labels[i]: float(probs[0][i]) for i in range(3)}
|
53 |
return confidences
|
|
|
|
|
|
|
|
|
54 |
|
55 |
+
title = "Simple demo for a Image Classification of the Beans Dataset with HF ViT model"
|
56 |
|
57 |
demo = gr.Interface(
|
58 |
get_predictions,
|
|
|
62 |
title=title,
|
63 |
)
|
64 |
|
65 |
+
demo.launch(debug=True)
|