Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -8,7 +8,14 @@ model = CustomModel()
|
|
| 8 |
def predict(image: Image.Image):
|
| 9 |
# Get predictions from the model
|
| 10 |
label, confidence = model.predict(image)
|
| 11 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12 |
|
| 13 |
# Define the Gradio interface with updated API
|
| 14 |
demo = gr.Interface(
|
|
|
|
| 8 |
def predict(image: Image.Image):
|
| 9 |
# Get predictions from the model
|
| 10 |
label, confidence = model.predict(image)
|
| 11 |
+
|
| 12 |
+
# Determine the result based on the label
|
| 13 |
+
if label == 1:
|
| 14 |
+
result = "AI image"
|
| 15 |
+
else:
|
| 16 |
+
result = "Real image"
|
| 17 |
+
|
| 18 |
+
return result, f"Confidence: {confidence:.2f}%"
|
| 19 |
|
| 20 |
# Define the Gradio interface with updated API
|
| 21 |
demo = gr.Interface(
|