AZIIIIIIIIZ commited on
Commit
7cc417d
1 Parent(s): 086d9db

Upload app.py

Browse files
Files changed (1) hide show
  1. app.py +37 -0
app.py ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # import gradio as gr
2
+
3
+ # demo = gr.load("AZIIIIIIIIZ/vit-base-patch16-224-finetuned-eurosat", src="models")
4
+
5
+ # demo.launch()
6
+
7
+ ###########################33
8
+
9
+ import gradio as gr
10
+
11
+ # Use a pipeline as a high-level helper
12
+ from transformers import pipeline
13
+
14
+ pipe = pipeline("image-classification", model="AZIIIIIIIIZ/vit-base-patch16-224-finetuned-eurosat")
15
+ # Use a pipeline as a high-level helper
16
+ # Load model directly
17
+ from transformers import AutoImageProcessor, AutoModelForImageClassification
18
+
19
+ processor = AutoImageProcessor.from_pretrained("AZIIIIIIIIZ/vit-base-patch16-224-finetuned-eurosat")
20
+ model = AutoModelForImageClassification.from_pretrained("AZIIIIIIIIZ/vit-base-patch16-224-finetuned-eurosat")
21
+
22
+ def predict(image):
23
+ return pipe(image)
24
+
25
+ demo = gr.Interface(
26
+ fn=predict,
27
+ inputs='image',
28
+ outputs='text',
29
+ )
30
+
31
+ demo.launch()
32
+
33
+ # $ pip install gradio_client fastapi uvicorn
34
+
35
+
36
+
37
+