arnaucas commited on
Commit
461fa19
1 Parent(s): 7ba7b00

Upload 2 files

Browse files
Files changed (2) hide show
  1. app.py +8 -2
  2. requirements.txt +0 -0
app.py CHANGED
@@ -1,12 +1,18 @@
1
  import gradio as gr
2
  import os
3
  from transformers import pipeline
 
4
 
5
- pipe = pipeline("image-classification", model="arnaucas/wildfire-classifier")
 
 
 
6
 
7
- example_imgs = os.listdir("./examples")
8
 
9
  def inference(image):
 
 
10
  output = pipe(image)
11
  result = {item['label']: item['score'] for item in output}
12
  return result
 
1
  import gradio as gr
2
  import os
3
  from transformers import pipeline
4
+ from pathlib import Path
5
 
6
+ example_imgs = ["examples/img0.jpg",
7
+ "examples/img1.jpg",
8
+ "examples/img2.jpg",
9
+ "examples/img3.jpg"]
10
 
11
+ pipe = pipeline("image-classification", model="arnaucas/wildfire-classifier")
12
 
13
  def inference(image):
14
+ if image in example_imgs:
15
+ image = "./examples/" + image
16
  output = pipe(image)
17
  result = {item['label']: item['score'] for item in output}
18
  return result
requirements.txt CHANGED
Binary files a/requirements.txt and b/requirements.txt differ