Chanlefe commited on
Commit
a3c5198
·
verified ·
1 Parent(s): 28a20f8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +1 -11
app.py CHANGED
@@ -3,15 +3,9 @@ from PIL import Image
3
  from transformers import AutoProcessor, AutoModelForImageClassification
4
  import gradio as gr
5
 
6
- # Load model and processor
7
- from transformers import AutoModelForImageClassification, AutoProcessor
8
-
9
  model = AutoModelForImageClassification.from_pretrained("model")
10
  processor = AutoProcessor.from_pretrained("model")
11
-
12
- model = AutoModelForImageClassification.from_pretrained(model_name)
13
- processor = AutoProcessor.from_pretrained(model_name)
14
-
15
  labels = model.config.id2label # e.g., {0: "non-hateful", 1: "hateful"}
16
 
17
  def classify_meme(image: Image.Image):
@@ -30,10 +24,6 @@ demo = gr.Interface(
30
  title="Meme Sentiment Classifier (SigLIP2)",
31
  description="Upload a meme to classify its sentiment using a SigLIP2-based model."
32
  )
33
- from transformers import AutoModelForImageClassification, AutoProcessor
34
-
35
- model = AutoModelForImageClassification.from_pretrained("model")
36
- processor = AutoProcessor.from_pretrained("model")
37
 
38
  if __name__ == "__main__":
39
  demo.launch()
 
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")
 
 
 
 
9
  labels = model.config.id2label # e.g., {0: "non-hateful", 1: "hateful"}
10
 
11
  def classify_meme(image: Image.Image):
 
24
  title="Meme Sentiment Classifier (SigLIP2)",
25
  description="Upload a meme to classify its sentiment using a SigLIP2-based model."
26
  )
 
 
 
 
27
 
28
  if __name__ == "__main__":
29
  demo.launch()