Spaces:
Configuration error
Configuration error
Delete detect()
Browse files
detect()
DELETED
|
@@ -1,23 +0,0 @@
|
|
| 1 |
-
import json
|
| 2 |
-
|
| 3 |
-
def detect(image):
|
| 4 |
-
try:
|
| 5 |
-
file_1 = handle_file(image)
|
| 6 |
-
except Exception as e:
|
| 7 |
-
print("β File handling error:", e)
|
| 8 |
-
return "β File Error", "β File Error", "β File Error"
|
| 9 |
-
|
| 10 |
-
try:
|
| 11 |
-
print("β
Sending request to backend...")
|
| 12 |
-
result_text = backend.predict(image=file_1, api_name="/detect")
|
| 13 |
-
print("β
API Response:", result_text)
|
| 14 |
-
|
| 15 |
-
result = json.loads(result_text)
|
| 16 |
-
if result.get("status") == "ok":
|
| 17 |
-
return result["overall"], result["aigen"], result["deepfake"]
|
| 18 |
-
else:
|
| 19 |
-
print("β Unexpected API response:", result)
|
| 20 |
-
return "β Unexpected Error", "β Unexpected Error", "β Unexpected Error"
|
| 21 |
-
except Exception as e:
|
| 22 |
-
print("β API call failed:", e)
|
| 23 |
-
return "β API Error", "β API Error", "β API Error"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|