Spaces:
Build error
Build error
yangwu
commited on
Commit
•
17c6031
1
Parent(s):
acff26c
update app.py
Browse files
app.py
CHANGED
@@ -2,6 +2,17 @@ import gradio as gr
|
|
2 |
import requests
|
3 |
|
4 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
def predict(img):
|
6 |
url = 'http://81.70.158.155:5005/predict'
|
7 |
with open(img, 'rb') as f:
|
@@ -23,6 +34,8 @@ iface = gr.Interface(
|
|
23 |
outputs='image',
|
24 |
title="Forged? Or Not?",
|
25 |
)
|
26 |
-
|
|
|
|
|
27 |
iface.launch()
|
28 |
|
|
|
2 |
import requests
|
3 |
|
4 |
|
5 |
+
def test()
|
6 |
+
url = 'http://81.70.158.155:5005/predict'
|
7 |
+
with open('./2680.jpg', 'rb') as f:
|
8 |
+
r = requests.post(url, files = {'image' : f})
|
9 |
+
ret = json.loads(r.text)
|
10 |
+
|
11 |
+
# image level cls score
|
12 |
+
pred_cls_score = ret['cls_score']
|
13 |
+
print('--------', pred_cls_score)
|
14 |
+
|
15 |
+
|
16 |
def predict(img):
|
17 |
url = 'http://81.70.158.155:5005/predict'
|
18 |
with open(img, 'rb') as f:
|
|
|
34 |
outputs='image',
|
35 |
title="Forged? Or Not?",
|
36 |
)
|
37 |
+
|
38 |
+
test()
|
39 |
+
|
40 |
iface.launch()
|
41 |
|