Upload with huggingface_hub
Browse files
README.md
CHANGED
@@ -5,8 +5,7 @@ emoji: 🔥
|
|
5 |
colorFrom: indigo
|
6 |
colorTo: indigo
|
7 |
sdk: gradio
|
8 |
-
sdk_version: 3.
|
9 |
-
|
10 |
app_file: app.py
|
11 |
pinned: false
|
12 |
---
|
|
|
5 |
colorFrom: indigo
|
6 |
colorTo: indigo
|
7 |
sdk: gradio
|
8 |
+
sdk_version: 3.4.1
|
|
|
9 |
app_file: app.py
|
10 |
pinned: false
|
11 |
---
|
app.py
CHANGED
@@ -1,13 +1,13 @@
|
|
1 |
import gradio as gr
|
2 |
import pathlib
|
3 |
|
4 |
-
current_dir = pathlib.Path(__file__)
|
5 |
|
6 |
-
images = [current_dir / "cheetah1.jpeg", current_dir / "cheetah1.jpg", current_dir / "lion.jpg"]
|
7 |
|
8 |
|
9 |
img_classifier = gr.Interface.load(
|
10 |
-
"models/google/vit-base-patch16-224", examples=images, cache_examples=
|
11 |
)
|
12 |
|
13 |
|
@@ -20,13 +20,13 @@ using_img_classifier_as_function = gr.Interface(
|
|
20 |
[gr.Image(type="filepath"), "text"],
|
21 |
["label", "text"],
|
22 |
examples=[
|
23 |
-
[current_dir / "cheetah1.jpeg", None],
|
24 |
-
[current_dir / "cheetah1.jpg", "cheetah"],
|
25 |
-
[current_dir / "lion.jpg", "lion"],
|
26 |
],
|
27 |
-
cache_examples=
|
28 |
)
|
29 |
demo = gr.TabbedInterface([using_img_classifier_as_function, img_classifier])
|
30 |
|
31 |
if __name__ == "__main__":
|
32 |
-
demo.launch()
|
|
|
1 |
import gradio as gr
|
2 |
import pathlib
|
3 |
|
4 |
+
current_dir = pathlib.Path(__file__).parent
|
5 |
|
6 |
+
images = [str(current_dir / "cheetah1.jpeg"), str(current_dir / "cheetah1.jpg"), str(current_dir / "lion.jpg")]
|
7 |
|
8 |
|
9 |
img_classifier = gr.Interface.load(
|
10 |
+
"models/google/vit-base-patch16-224", examples=images, cache_examples=False
|
11 |
)
|
12 |
|
13 |
|
|
|
20 |
[gr.Image(type="filepath"), "text"],
|
21 |
["label", "text"],
|
22 |
examples=[
|
23 |
+
[str(current_dir / "cheetah1.jpeg"), None],
|
24 |
+
[str(current_dir / "cheetah1.jpg"), "cheetah"],
|
25 |
+
[str(current_dir / "lion.jpg"), "lion"],
|
26 |
],
|
27 |
+
cache_examples=False,
|
28 |
)
|
29 |
demo = gr.TabbedInterface([using_img_classifier_as_function, img_classifier])
|
30 |
|
31 |
if __name__ == "__main__":
|
32 |
+
demo.launch()
|