jdmartinev commited on
Commit
528b61c
·
1 Parent(s): a7da9bb
Files changed (1) hide show
  1. app.py +8 -9
app.py CHANGED
@@ -1,17 +1,16 @@
1
  import gradio as gr
2
- #from fastai.learner import load_learner
3
- #from fastai.vision.core import PILImage
4
- #from huggingface_hub import hf_hub_download
5
 
6
 
7
- #learner = load_learner(hf_hub_download("jdmartinev/intel_image_classification_fastai","model.pkl"))
8
 
9
  def classify_image(image):
10
- #img = PILImage.create(image)
11
- #pred_class, pred_idx, outputs = learn.predict(img)
12
- #return(f"Predicted class: {pred_class}")
13
- return("edificio")
14
-
15
  demo = gr.Interface(classify_image, gr.Image(shape=(224, 224)), "text")
16
  demo.launch()
17
 
 
1
  import gradio as gr
2
+ from fastai.learner import load_learner
3
+ from fastai.vision.core import PILImage
4
+ from huggingface_hub import hf_hub_download
5
 
6
 
7
+ learner = load_learner(hf_hub_download("jdmartinev/intel_image_classification_fastai","model.pkl"))
8
 
9
  def classify_image(image):
10
+ img = PILImage.create(image)
11
+ pred_class, pred_idx, outputs = learner.predict(img)
12
+ return(f"Predicted class: {pred_class}")
13
+
 
14
  demo = gr.Interface(classify_image, gr.Image(shape=(224, 224)), "text")
15
  demo.launch()
16