Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -3,6 +3,7 @@ import transformers
|
|
3 |
from torch import nn
|
4 |
import numpy as np
|
5 |
import gradio as gr
|
|
|
6 |
|
7 |
# Instantiate classification model
|
8 |
from fastai.vision.all import *
|
@@ -117,7 +118,7 @@ def predict(classification_mode, image):
|
|
117 |
percentage_affected = round((pixels_count[1]/960)*100, 1)
|
118 |
percentage_affected = str(percentage_affected) + '%'
|
119 |
|
120 |
-
|
121 |
|
122 |
return ({labels[i]: float(probs[i]) for i in range(len(labels))}, seg_img, percentage_affected)
|
123 |
|
|
|
3 |
from torch import nn
|
4 |
import numpy as np
|
5 |
import gradio as gr
|
6 |
+
import PIL
|
7 |
|
8 |
# Instantiate classification model
|
9 |
from fastai.vision.all import *
|
|
|
118 |
percentage_affected = round((pixels_count[1]/960)*100, 1)
|
119 |
percentage_affected = str(percentage_affected) + '%'
|
120 |
|
121 |
+
seg_img = PIL.Image.fromarray(seg_img)
|
122 |
|
123 |
return ({labels[i]: float(probs[i]) for i in range(len(labels))}, seg_img, percentage_affected)
|
124 |
|