Spaces:
Runtime error
Runtime error
fixed bugs of prediction
Browse files
app.py
CHANGED
|
@@ -89,6 +89,7 @@ def get_caption(image):
|
|
| 89 |
|
| 90 |
def predict(img):
|
| 91 |
caption = get_caption(img)
|
|
|
|
| 92 |
prediction=[]
|
| 93 |
models_list = ['clip-sd.pth', 'clip-glide.pth', 'clip-ld.pth']
|
| 94 |
modality = "Image+Text"
|
|
@@ -99,7 +100,7 @@ def predict(img):
|
|
| 99 |
with torch.no_grad():
|
| 100 |
out = model(input_tensor, caption)
|
| 101 |
print('------------>', out)
|
| 102 |
-
prediction.append(out)
|
| 103 |
|
| 104 |
if prediction[0] > 0.5:
|
| 105 |
return "Fake"
|
|
|
|
| 89 |
|
| 90 |
def predict(img):
|
| 91 |
caption = get_caption(img)
|
| 92 |
+
print("caption")
|
| 93 |
prediction=[]
|
| 94 |
models_list = ['clip-sd.pth', 'clip-glide.pth', 'clip-ld.pth']
|
| 95 |
modality = "Image+Text"
|
|
|
|
| 100 |
with torch.no_grad():
|
| 101 |
out = model(input_tensor, caption)
|
| 102 |
print('------------>', out)
|
| 103 |
+
prediction.append(out.item())
|
| 104 |
|
| 105 |
if prediction[0] > 0.5:
|
| 106 |
return "Fake"
|