LuisCe commited on
Commit
906ca7b
verified
1 Parent(s): 53870ca

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -4
app.py CHANGED
@@ -1,17 +1,21 @@
1
- # Codigo de la aplicaci贸n
2
  import gradio as gr
 
3
  from fastai.learner import load_learner
4
  from PIL import Image
5
 
6
  # Load the learner
7
- learn_inf = load_learner("LuisCe/Practica03")
 
 
 
8
 
9
  # Define the prediction function
10
  def predict_image(img):
11
  # Convert the PIL image to a format that fastai expects
12
- img_fastai = Image.fromarray(img.astype('uint8'), 'RGB')
13
  # Make prediction
14
- pred, _, _ = learn_inf.predict(img_fastai)
15
  # Return prediction
16
  return pred
17
 
 
1
+ from huggingface_hub import from_pretrained_fastai
2
  import gradio as gr
3
+ from fastai.vision.all import *
4
  from fastai.learner import load_learner
5
  from PIL import Image
6
 
7
  # Load the learner
8
+ repo_id ="LuisCe/Practica03"
9
+
10
+ learner = from_pretrained_fastai(repo_id)
11
+ # learn_inf = load_learner("LuisCe/Practica03")
12
 
13
  # Define the prediction function
14
  def predict_image(img):
15
  # Convert the PIL image to a format that fastai expects
16
+ # img_fastai = Image.fromarray(img.astype('uint8'), 'RGB')
17
  # Make prediction
18
+ pred, _, _ = learner.predict(img_fastai)
19
  # Return prediction
20
  return pred
21