Spaces:
Runtime error
Runtime error
Upload 2 files
Browse files- app.py +8 -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 |
-
|
|
|
|
|
|
|
6 |
|
7 |
-
|
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
|
|