-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinference_test.py
47 lines (38 loc) · 2.81 KB
/
inference_test.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
from transformers import pipeline
# Create inference pipeline for our model.
model_id = "itsx-tom/estates-exterier-interier-classifier"
pipe = pipeline("image-classification", model=model_id)
print(f"Model ID: {model_id}")
# Run some tests.
print(f"parrot: {pipe('https://huggingface.co/datasets/Narsil/image_dummy/raw/main/parrots.png')}")
print(f"house exterier: {pipe('https://img.flatzone.cz/thumbnails/350x200/dcd4d8d2b04e401e.webp')}")
print(f"house exterier: {pipe('https://img.flatzone.cz/thumbnails/350x200/65291922a07c90ac.webp')}")
print(f"house exterier: {pipe('https://img.flatzone.cz/thumbnails/350x200/c9882b74e1a7dbf2.webp')}")
print(f"house exterier: {pipe('https://img.flatzone.cz/thumbnails/350x200/4ab6dc1ff32f3e6d.webp')}")
print(f"house exterier: {pipe('https://img.flatzone.cz/thumbnails/350x200/498a5be374390542.webp')}")
print(f"house exterier: {pipe('https://img.flatzone.cz/thumbnails/350x200/0f55ba9452a6f784.webp')}")
print(f"house interier: {pipe('https://img.flatzone.cz/thumbnails/350x200/2a73f552beea8da8.webp')}")
print(f"house interier: {pipe('https://img.flatzone.cz/thumbnails/350x200/88eebca3149a8dfe.webp')}")
# Create inference pipeline for example model.
model_id = "andupets/real-estate-image-classification"
pipe = pipeline("image-classification", model=model_id)
print(f"Model ID: {model_id}")
# Run some tests.
print(f"parrot: {pipe('https://huggingface.co/datasets/Narsil/image_dummy/raw/main/parrots.png')}")
print(f"house facade: {pipe('https://img.flatzone.cz/thumbnails/350x200/dcd4d8d2b04e401e.webp')}")
# Create inference pipeline for our model.
model_id = "itsx-tom/estates-testing-classifier"
pipe = pipeline("image-classification", model=model_id)
print(f"Model ID: {model_id}")
# Run some tests.
print(f"parrot: {pipe('https://huggingface.co/datasets/Narsil/image_dummy/raw/main/parrots.png')}")
print(f"house exterier: {pipe('https://img.flatzone.cz/thumbnails/350x200/dcd4d8d2b04e401e.webp')}")
print(f"house exterier: {pipe('https://img.flatzone.cz/thumbnails/350x200/65291922a07c90ac.webp')}")
print(f"house exterier: {pipe('https://img.flatzone.cz/thumbnails/350x200/c9882b74e1a7dbf2.webp')}")
print(f"house exterier: {pipe('https://img.flatzone.cz/thumbnails/350x200/4ab6dc1ff32f3e6d.webp')}")
print(f"house exterier: {pipe('https://img.flatzone.cz/thumbnails/350x200/498a5be374390542.webp')}")
print(f"house exterier: {pipe('https://img.flatzone.cz/thumbnails/350x200/0f55ba9452a6f784.webp')}")
print(f"house interier: {pipe('https://img.flatzone.cz/thumbnails/350x200/2a73f552beea8da8.webp')}")
print(f"house interier: {pipe('https://img.flatzone.cz/thumbnails/350x200/88eebca3149a8dfe.webp')}")
print(f"real photo exterier: {pipe('https://img.flatzone.cz/thumbnails/350x200/252307b3a3dd82a0.webp')}")
print(f"real photo exterier: {pipe('https://img.flatzone.cz/thumbnails/350x200/e895ef16a7c7f356.webp')}")