bhushanp commited on
Commit
722f1de
β€’
1 Parent(s): b561682

path changes

Browse files
Files changed (2) hide show
  1. app.py +3 -2
  2. requirements.txt +1 -0
app.py CHANGED
@@ -2,7 +2,8 @@ import gradio as gr
2
  from fastai.vision.all import *
3
  import os
4
  # Load a pre-trained image classification model
5
- learn = load_learner('./models/model.pth')
 
6
 
7
  # Function to make predictions from an image
8
  def classify_image(image):
@@ -12,7 +13,7 @@ def classify_image(image):
12
  return name[0]
13
 
14
  # Sample images for user to choose from
15
- sample_images = ["./sample_images/AcuraTLType-S2008.jpg", "./sample_images/AudiR8Coupe2012.jpg", "./sample_images/DodgeMagnumWagon2008.jpg"]
16
 
17
  iface = gr.Interface(
18
  fn=classify_image,
 
2
  from fastai.vision.all import *
3
  import os
4
  # Load a pre-trained image classification model
5
+ root = os.path.dirname(__file__)
6
+ learn = load_learner(os.path.join(root, "models", "model.pth"))
7
 
8
  # Function to make predictions from an image
9
  def classify_image(image):
 
13
  return name[0]
14
 
15
  # Sample images for user to choose from
16
+ sample_images = [os.path.join(root, sample_images, "AcuraTLType-S2008.jpg"), os.path.join(root, sample_images, "AudiR8Coupe2012.jpg"), os.path.join(root, sample_images, "DodgeMagnumWagon2008.jpg")]
17
 
18
  iface = gr.Interface(
19
  fn=classify_image,
requirements.txt CHANGED
@@ -1,3 +1,4 @@
 
1
  fastai
2
  torch
3
  gradio
 
1
+ os
2
  fastai
3
  torch
4
  gradio