Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -21,7 +21,7 @@ pipe1 = pipeline("image-classification", f"{models[1]}")
|
|
21 |
pipe2 = pipeline("image-classification", f"{models[2]}")
|
22 |
|
23 |
def image_classifier0(image):
|
24 |
-
labels = ["
|
25 |
outputs = pipe0(image)
|
26 |
results = {}
|
27 |
result_test={}
|
@@ -32,14 +32,24 @@ def image_classifier0(image):
|
|
32 |
results[result['label']] = result['score']
|
33 |
return results
|
34 |
def image_classifier1(image):
|
|
|
35 |
outputs = pipe1(image)
|
36 |
results = {}
|
|
|
|
|
|
|
|
|
37 |
for result in outputs:
|
38 |
results[result['label']] = result['score']
|
39 |
return results
|
40 |
def image_classifier2(image):
|
|
|
41 |
outputs = pipe2(image)
|
42 |
results = {}
|
|
|
|
|
|
|
|
|
43 |
for result in outputs:
|
44 |
results[result['label']] = result['score']
|
45 |
return results
|
|
|
21 |
pipe2 = pipeline("image-classification", f"{models[2]}")
|
22 |
|
23 |
def image_classifier0(image):
|
24 |
+
labels = ["AI", "Real"]
|
25 |
outputs = pipe0(image)
|
26 |
results = {}
|
27 |
result_test={}
|
|
|
32 |
results[result['label']] = result['score']
|
33 |
return results
|
34 |
def image_classifier1(image):
|
35 |
+
labels = ["AI", "Real"]
|
36 |
outputs = pipe1(image)
|
37 |
results = {}
|
38 |
+
result_test={}
|
39 |
+
for idx,result in enumerate(outputs):
|
40 |
+
result_test[labels[idx]] = outputs[idx]['score']
|
41 |
+
print (result_test)
|
42 |
for result in outputs:
|
43 |
results[result['label']] = result['score']
|
44 |
return results
|
45 |
def image_classifier2(image):
|
46 |
+
labels = ["AI", "Real"]
|
47 |
outputs = pipe2(image)
|
48 |
results = {}
|
49 |
+
result_test={}
|
50 |
+
for idx,result in enumerate(outputs):
|
51 |
+
result_test[labels[idx]] = outputs[idx]['score']
|
52 |
+
print (result_test)
|
53 |
for result in outputs:
|
54 |
results[result['label']] = result['score']
|
55 |
return results
|