nickmuchi commited on
Commit
f7fcf35
1 Parent(s): a8aa8cb

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -3
app.py CHANGED
@@ -1,6 +1,5 @@
1
  import io
2
  import gradio as gr
3
- import matplotlib.pyplot as plt
4
  import requests, validators
5
  import torch
6
  import pathlib
@@ -12,8 +11,8 @@ import os
12
 
13
  os.environ["KMP_DUPLICATE_LIB_OK"]="TRUE"
14
 
15
- feature_extractor = AutoFeatureExtractor.from_pretrained("/content/drive/MyDrive/Week 1 Project/saved_model_files")
16
- model = AutoModelForImageClassification.from_pretrained("/content/drive/MyDrive/Week 1 Project/saved_model_files")
17
 
18
  labels = ['angular_leaf_spot', 'bean_rust', 'healthy']
19
 
@@ -62,6 +61,8 @@ def set_example_url(example: list) -> dict:
62
 
63
  title = """<h1 id="title">Plant Health Classification with ViT</h1>"""
64
 
 
 
65
  description = """
66
  This Plant Health classifier app was built to detect the health of plants using images of leaves by fine-tuning a Vision Transformer (ViT) [google/vit-base-patch16-224](https://huggingface.co/google/vit-base-patch16-224) on the [Beans](https://huggingface.co/datasets/beans) dataset.
67
  The finetuned model has an accuracy of 98.4% on the test (unseen) dataset and 100% on the validation dataset.
 
1
  import io
2
  import gradio as gr
 
3
  import requests, validators
4
  import torch
5
  import pathlib
 
11
 
12
  os.environ["KMP_DUPLICATE_LIB_OK"]="TRUE"
13
 
14
+ feature_extractor = AutoFeatureExtractor.from_pretrained("saved_model_files")
15
+ model = AutoModelForImageClassification.from_pretrained("saved_model_files")
16
 
17
  labels = ['angular_leaf_spot', 'bean_rust', 'healthy']
18
 
 
61
 
62
  title = """<h1 id="title">Plant Health Classification with ViT</h1>"""
63
 
64
+ gr.Image('images/Healthy.png',label = 'Healthy Plant'), gr.Image('images/sickie.png',label = 'Infected Plant')
65
+
66
  description = """
67
  This Plant Health classifier app was built to detect the health of plants using images of leaves by fine-tuning a Vision Transformer (ViT) [google/vit-base-patch16-224](https://huggingface.co/google/vit-base-patch16-224) on the [Beans](https://huggingface.co/datasets/beans) dataset.
68
  The finetuned model has an accuracy of 98.4% on the test (unseen) dataset and 100% on the validation dataset.