Ignaciobfp commited on
Commit
e638fa5
·
verified ·
1 Parent(s): f0161fc

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -11
app.py CHANGED
@@ -2,6 +2,8 @@ import gradio as gr
2
  from fastai.vision.all import *
3
  from huggingface_hub import from_pretrained_fastai
4
 
 
 
5
  # Cargar el modelo preentrenado
6
  repo_id = "ignaciobfp/moonboard_difficulty"
7
  learner = from_pretrained_fastai(repo_id)
@@ -22,20 +24,14 @@ def predict(img):
22
  "Input Image": img
23
  }
24
 
 
 
 
 
25
  iface = gr.Interface(
26
  predict,
27
  gr.Image(type="pil"),
28
  "image",
29
- examples = [
30
- gr.Image.from_file("easy1.jpg"),
31
- gr.Image.from_file("easy2.jpg"),
32
- gr.Image.from_file("easy3.jpg"),
33
- gr.Image.from_file("med1.jpg"),
34
- gr.Image.from_file("med2.jpg"),
35
- gr.Image.from_file("med3.jpg"),
36
- gr.Image.from_file("hard1.jpg"),
37
- gr.Image.from_file("hard2.jpg"),
38
- gr.Image.from_file("hard3.jpg")
39
- ],
40
  )
41
  iface.launch(share=False)
 
2
  from fastai.vision.all import *
3
  from huggingface_hub import from_pretrained_fastai
4
 
5
+ import pathlib
6
+
7
  # Cargar el modelo preentrenado
8
  repo_id = "ignaciobfp/moonboard_difficulty"
9
  learner = from_pretrained_fastai(repo_id)
 
24
  "Input Image": img
25
  }
26
 
27
+
28
+ image_dir = pathlib.Path('')
29
+ examples = [[path.as_posix()] for path in sorted(image_dir.glob('*.jpg'))]
30
+
31
  iface = gr.Interface(
32
  predict,
33
  gr.Image(type="pil"),
34
  "image",
35
+ examples = examples,
 
 
 
 
 
 
 
 
 
 
36
  )
37
  iface.launch(share=False)