File size: 923 Bytes
7cc417d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
# import gradio as gr

# demo = gr.load("AZIIIIIIIIZ/vit-base-patch16-224-finetuned-eurosat", src="models")

# demo.launch()

###########################33

import gradio as gr

# Use a pipeline as a high-level helper
from transformers import pipeline

pipe = pipeline("image-classification", model="AZIIIIIIIIZ/vit-base-patch16-224-finetuned-eurosat")
# Use a pipeline as a high-level helper
# Load model directly
from transformers import AutoImageProcessor, AutoModelForImageClassification

processor = AutoImageProcessor.from_pretrained("AZIIIIIIIIZ/vit-base-patch16-224-finetuned-eurosat")
model = AutoModelForImageClassification.from_pretrained("AZIIIIIIIIZ/vit-base-patch16-224-finetuned-eurosat")

def predict(image):
  return pipe(image)

demo = gr.Interface(
  fn=predict,
  inputs='image',
  outputs='text',
)

demo.launch()

# $ pip install gradio_client fastapi uvicorn