benjaminStreltzin commited on
Commit
201c263
·
verified ·
1 Parent(s): 6976bb1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -1
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
- return f"Predicted label: {label}", f"Confidence: {confidence:.2f}%"
 
 
 
 
 
 
 
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(