Maria-tamu commited on
Commit
660cdb2
·
verified ·
1 Parent(s): 26a646a

Upload 10 files

Browse files
.gitattributes CHANGED
@@ -33,3 +33,10 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
 
 
 
 
 
 
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ animal_images/cat.png filter=lfs diff=lfs merge=lfs -text
37
+ animal_images/frog.png filter=lfs diff=lfs merge=lfs -text
38
+ animal_images/hippo.png filter=lfs diff=lfs merge=lfs -text
39
+ animal_images/jaguar.png filter=lfs diff=lfs merge=lfs -text
40
+ animal_images/sloth.png filter=lfs diff=lfs merge=lfs -text
41
+ animal_images/toucan.png filter=lfs diff=lfs merge=lfs -text
42
+ animal_images/turtle.png filter=lfs diff=lfs merge=lfs -text
animal_images/cat.jpeg ADDED
animal_images/cat.png ADDED

Git LFS Details

  • SHA256: 8dbe0fc8a74b0c8d146ec75f337713082fdc40ac2c43e986fa0c8c8f2ff14d80
  • Pointer size: 131 Bytes
  • Size of remote file: 139 kB
animal_images/frog.png ADDED

Git LFS Details

  • SHA256: cf168ff5d42d4659ee810c4be7da623969106f4eecf0438ce8ad0104955ce20e
  • Pointer size: 131 Bytes
  • Size of remote file: 314 kB
animal_images/hippo.png ADDED

Git LFS Details

  • SHA256: a1085c6fbec1b0378e500d603c07670402c9c875827ceda32fb85305f3cc41ef
  • Pointer size: 131 Bytes
  • Size of remote file: 552 kB
animal_images/jaguar.png ADDED

Git LFS Details

  • SHA256: 086fe443bdbc479ff3d380f5a3ec2d348158bebb83a33f43263c3eaad593b33b
  • Pointer size: 131 Bytes
  • Size of remote file: 578 kB
animal_images/sloth.png ADDED

Git LFS Details

  • SHA256: 69f7720ee894a7472eb1c65f07726be7d2f1c293fed0b702e0d8b2b4363d78cd
  • Pointer size: 131 Bytes
  • Size of remote file: 414 kB
animal_images/toucan.png ADDED

Git LFS Details

  • SHA256: fe3ad6b6c8a78bd2e2c563002a251fbd1ce74e6728c201e4654e582d0dbed893
  • Pointer size: 131 Bytes
  • Size of remote file: 112 kB
animal_images/turtle.png ADDED

Git LFS Details

  • SHA256: 672334ae4126ea106db7c1a5850b68bee39d5d13badfea909a2c421639d767c6
  • Pointer size: 131 Bytes
  • Size of remote file: 426 kB
app_v4.py ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from transformers import pipeline
3
+
4
+ # Load the image classification pipeline
5
+ classifier = pipeline("image-classification", model="google/vit-base-patch16-224")
6
+
7
+ def predict(image):
8
+ if image is None:
9
+ return None
10
+ predictions = classifier(image)
11
+ return {p["label"]: p["score"] for p in predictions}
12
+
13
+ # Updated examples list to use cat.jpeg instead of cat.png
14
+ examples = [
15
+ "animal_images/hippo.png",
16
+ "animal_images/jaguar.png",
17
+ "animal_images/toucan.png",
18
+ "animal_images/sloth.png",
19
+ "animal_images/cat.jpeg", # Changed to jpeg
20
+ "animal_images/frog.png",
21
+ "animal_images/turtle.png"
22
+ ]
23
+
24
+ demo = gr.Interface(
25
+ fn=predict,
26
+ inputs=gr.Image(
27
+ type="pil",
28
+ label="Input Image",
29
+ interactive=True,
30
+ height=None
31
+ ),
32
+ outputs=gr.Label(num_top_classes=3, label="Predictions"),
33
+ examples=examples,
34
+ title="Animal Classifier",
35
+ description="Upload an image of an animal."
36
+ )
37
+
38
+ if __name__ == "__main__":
39
+ demo.launch()
40
+
requirements.txt ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ gradio
2
+ transformers
3
+ torch
4
+ pillow
5
+
6
+