Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -5,17 +5,16 @@ from vit_model_test import CustomModel
|
|
5 |
# Initialize the model
|
6 |
model = CustomModel()
|
7 |
|
8 |
-
|
9 |
-
|
10 |
-
with gr.Blocks(theme=theme) as demo:
|
11 |
-
|
12 |
-
def predict(image: Image.Image):
|
13 |
animation.visible = True # Show the animation
|
14 |
label, confidence = model.predict(image)
|
15 |
result = "AI image" if label == 1 else "Real image"
|
16 |
animation.visible = False # Hide the animation
|
17 |
return result, f"Confidence: {confidence:.2f}%"
|
18 |
|
|
|
|
|
|
|
19 |
# Define the Gradio interface
|
20 |
gr.Interface(
|
21 |
fn=predict,
|
|
|
5 |
# Initialize the model
|
6 |
model = CustomModel()
|
7 |
|
8 |
+
def predict(image: Image.Image):
|
|
|
|
|
|
|
|
|
9 |
animation.visible = True # Show the animation
|
10 |
label, confidence = model.predict(image)
|
11 |
result = "AI image" if label == 1 else "Real image"
|
12 |
animation.visible = False # Hide the animation
|
13 |
return result, f"Confidence: {confidence:.2f}%"
|
14 |
|
15 |
+
theme = gr.themes.Base()
|
16 |
+
|
17 |
+
with gr.Blocks(theme=theme) as demo:
|
18 |
# Define the Gradio interface
|
19 |
gr.Interface(
|
20 |
fn=predict,
|