azlan8289 commited on
Commit
2ab36bd
·
verified ·
1 Parent(s): 652cc15

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -10
app.py CHANGED
@@ -1,17 +1,12 @@
1
  import gradio as gr
2
  import tensorflow as tf
3
- import requests
4
- from io import BytesIO
5
 
6
- # Function to download the model from Hugging Face
7
- def download_model(model_url):
8
- response = requests.get(model_url)
9
- model = tf.keras.models.load_model(BytesIO(response.content))
10
- return model
11
 
12
- # Direct link to your .h5 model file on Hugging Face
13
- MODEL_URL = 'https://huggingface.co/azlan8289/fruitquality-1.0/tree/main/fruitquality-1.0.h5'
14
- model = download_model(MODEL_URL)
15
 
16
  # Define class names based on your labels
17
  CLASS_NAMES = [
 
1
  import gradio as gr
2
  import tensorflow as tf
 
 
3
 
4
+ # Define the path to your model relative to `app.py`
5
+ # Since they're in the same directory, you just need the model file name
6
+ MODEL_PATH = 'fruitquality-1.0.h5'
 
 
7
 
8
+ # Load the model directly from the file system
9
+ model = tf.keras.models.load_model(MODEL_PATH)
 
10
 
11
  # Define class names based on your labels
12
  CLASS_NAMES = [