Chanlefe commited on
Commit
21bab57
·
verified ·
1 Parent(s): ef2975e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -4
app.py CHANGED
@@ -3,10 +3,10 @@ from PIL import Image
3
  from transformers import AutoProcessor, AutoModelForImageClassification
4
  import gradio as gr
5
 
6
- # Load model and processor from local "model" folder
7
- model = AutoModelForImageClassification.from_pretrained("model")
8
- processor = AutoProcessor.from_pretrained("model",use_fast = False)
9
- labels = model.config.id2label # e.g., {0: "non-hateful", 1: "hateful"}
10
 
11
  def classify_meme(image: Image.Image):
12
  inputs = processor(images=image, return_tensors="pt").to(model.device)
@@ -27,3 +27,4 @@ demo = gr.Interface(
27
 
28
  if __name__ == "__main__":
29
  demo.launch()
 
 
3
  from transformers import AutoProcessor, AutoModelForImageClassification
4
  import gradio as gr
5
 
6
+ # Load model and processor from Hugging Face
7
+ model = AutoModelForImageClassification.from_pretrained("google/siglip2-base-patch16-naflex")
8
+ processor = AutoProcessor.from_pretrained("google/siglip2-base-patch16-naflex")
9
+ labels = model.config.id2label
10
 
11
  def classify_meme(image: Image.Image):
12
  inputs = processor(images=image, return_tensors="pt").to(model.device)
 
27
 
28
  if __name__ == "__main__":
29
  demo.launch()
30
+