Spaces:
Sleeping
Sleeping
siddhantuniyal
commited on
Commit
•
113622c
1
Parent(s):
4593d5d
Update app.py
Browse files
app.py
CHANGED
@@ -16,16 +16,20 @@ def extract_text(image):
|
|
16 |
return ' '.join([l for l in data])
|
17 |
|
18 |
def predict(image):
|
19 |
-
|
|
|
|
|
|
|
|
|
20 |
imgResult = clientImg.predict(
|
21 |
-
|
22 |
-
|
23 |
)
|
24 |
|
25 |
if float(imgResult[1]['label']) > 0.95:
|
26 |
return ["hate" , imgResult[0]]
|
27 |
else:
|
28 |
-
|
29 |
ocr_text = extract_text(image)
|
30 |
|
31 |
engResult = clientEngText.predict(
|
|
|
16 |
return ' '.join([l for l in data])
|
17 |
|
18 |
def predict(image):
|
19 |
+
|
20 |
+
img_byte_arr = io.BytesIO()
|
21 |
+
image.save(img_byte_arr, format='PNG')
|
22 |
+
img_byte_arr.seek(0)
|
23 |
+
|
24 |
imgResult = clientImg.predict(
|
25 |
+
img_byte_arr,
|
26 |
+
api_name="/predict"
|
27 |
)
|
28 |
|
29 |
if float(imgResult[1]['label']) > 0.95:
|
30 |
return ["hate" , imgResult[0]]
|
31 |
else:
|
32 |
+
|
33 |
ocr_text = extract_text(image)
|
34 |
|
35 |
engResult = clientEngText.predict(
|