Spaces:
Sleeping
Sleeping
Commit ·
a117b1d
1
Parent(s): 22b7ae6
Update app.py
Browse files
app.py
CHANGED
|
@@ -2,6 +2,10 @@ import datasets
|
|
| 2 |
from datasets import load_dataset
|
| 3 |
import gradio as gr
|
| 4 |
import torch
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
from transformers import AutoFeatureExtractor, AutoModelForImageClassification
|
| 6 |
|
| 7 |
dataset = load_dataset('beans') # This should be the same as the first line of Python code in this Colab notebook
|
|
@@ -10,6 +14,7 @@ extractor = AutoFeatureExtractor.from_pretrained("saved_model_files")
|
|
| 10 |
model = AutoModelForImageClassification.from_pretrained("saved_model_files")
|
| 11 |
|
| 12 |
labels = dataset['train'].features['labels'].names
|
|
|
|
| 13 |
|
| 14 |
def classify(im):
|
| 15 |
features = image_processor(im, return_tensors='pt')
|
|
|
|
| 2 |
from datasets import load_dataset
|
| 3 |
import gradio as gr
|
| 4 |
import torch
|
| 5 |
+
from transformers import Trainer, TrainingArguments
|
| 6 |
+
from transformers import AutoModelForImageClassification
|
| 7 |
+
import numpy as np
|
| 8 |
+
import evaluate
|
| 9 |
from transformers import AutoFeatureExtractor, AutoModelForImageClassification
|
| 10 |
|
| 11 |
dataset = load_dataset('beans') # This should be the same as the first line of Python code in this Colab notebook
|
|
|
|
| 14 |
model = AutoModelForImageClassification.from_pretrained("saved_model_files")
|
| 15 |
|
| 16 |
labels = dataset['train'].features['labels'].names
|
| 17 |
+
image_processor = ViTImageProcessor.from_pretrained('google/vit-base-patch16-224')
|
| 18 |
|
| 19 |
def classify(im):
|
| 20 |
features = image_processor(im, return_tensors='pt')
|