Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -7,6 +7,7 @@ import time
|
|
| 7 |
model = CustomModel()
|
| 8 |
|
| 9 |
def predict(image: Image.Image):
|
|
|
|
| 10 |
time.sleep(5) # 住讬诪讜诇爪讬讛 砖诇 讝诪谉 注讬讘讜讚
|
| 11 |
label, confidence = model.predict(image)
|
| 12 |
result = "AI image" if label == 1 else "Real image"
|
|
@@ -29,13 +30,6 @@ with gr.Blocks(css="""
|
|
| 29 |
.gr-button:hover {
|
| 30 |
background-color: #45a049;
|
| 31 |
}
|
| 32 |
-
.fade-in {
|
| 33 |
-
animation: fadeIn 0.5s ease-in;
|
| 34 |
-
}
|
| 35 |
-
@keyframes fadeIn {
|
| 36 |
-
from { opacity: 0; }
|
| 37 |
-
to { opacity: 1; }
|
| 38 |
-
}
|
| 39 |
""") as demo:
|
| 40 |
with gr.Row():
|
| 41 |
image_input = gr.Image(type="pil", label="Upload an image")
|
|
@@ -48,7 +42,7 @@ with gr.Blocks(css="""
|
|
| 48 |
image_input.change(show_results, inputs=image_input, outputs=[animation, output_label, output_confidence])
|
| 49 |
|
| 50 |
# 讛讜住驻转 讻驻转讜专
|
| 51 |
-
submit_button = gr.Button("Submit")
|
| 52 |
submit_button.click(predict, inputs=image_input, outputs=[output_label, output_confidence])
|
| 53 |
|
| 54 |
# 讛砖拽转 讛诪诪砖拽
|
|
|
|
| 7 |
model = CustomModel()
|
| 8 |
|
| 9 |
def predict(image: Image.Image):
|
| 10 |
+
print("Predict function called") # 讛讜住驻转 砖讜专转 讛讚驻住讛
|
| 11 |
time.sleep(5) # 住讬诪讜诇爪讬讛 砖诇 讝诪谉 注讬讘讜讚
|
| 12 |
label, confidence = model.predict(image)
|
| 13 |
result = "AI image" if label == 1 else "Real image"
|
|
|
|
| 30 |
.gr-button:hover {
|
| 31 |
background-color: #45a049;
|
| 32 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 33 |
""") as demo:
|
| 34 |
with gr.Row():
|
| 35 |
image_input = gr.Image(type="pil", label="Upload an image")
|
|
|
|
| 42 |
image_input.change(show_results, inputs=image_input, outputs=[animation, output_label, output_confidence])
|
| 43 |
|
| 44 |
# 讛讜住驻转 讻驻转讜专
|
| 45 |
+
submit_button = gr.Button("Submit")
|
| 46 |
submit_button.click(predict, inputs=image_input, outputs=[output_label, output_confidence])
|
| 47 |
|
| 48 |
# 讛砖拽转 讛诪诪砖拽
|