Spaces:
Sleeping
Sleeping
Delete deployment
Browse files- deployment/gradio/__init__.py +0 -0
- deployment/gradio/app.py +0 -41
deployment/gradio/__init__.py
DELETED
|
File without changes
|
deployment/gradio/app.py
DELETED
|
@@ -1,41 +0,0 @@
|
|
| 1 |
-
import gradio as gr
|
| 2 |
-
from src.infer import inference_pipeline
|
| 3 |
-
|
| 4 |
-
# model_path = "checkpoints/ckpt_23_10_2025/best_cat_dog_classifier_model_20251019_122336.pth"
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
def classify_image(
|
| 8 |
-
image_path: str
|
| 9 |
-
) -> str:
|
| 10 |
-
"""
|
| 11 |
-
Classify the input image as cat or dog.
|
| 12 |
-
"""
|
| 13 |
-
if image_path is None:
|
| 14 |
-
return "Please upload an image."
|
| 15 |
-
try:
|
| 16 |
-
prediction = inference_pipeline(
|
| 17 |
-
image_path=image_path,
|
| 18 |
-
model_path=model_path,
|
| 19 |
-
hf=True
|
| 20 |
-
)
|
| 21 |
-
return f"Prediction: {prediction.capitalize()}"
|
| 22 |
-
except Exception as e:
|
| 23 |
-
return f"Error: {str(e)}"
|
| 24 |
-
|
| 25 |
-
with gr.Blocks() as demo:
|
| 26 |
-
gr.Markdown("# 🐶🐱 Cat vs Dog Classifier")
|
| 27 |
-
|
| 28 |
-
with gr.Row():
|
| 29 |
-
with gr.Column():
|
| 30 |
-
image_input = gr.Image(
|
| 31 |
-
type="filepath",
|
| 32 |
-
label="Input"
|
| 33 |
-
)
|
| 34 |
-
classify_button = gr.Button("🔍 Classify")
|
| 35 |
-
with gr.Column():
|
| 36 |
-
output_text = gr.Textbox(label="🧠 Prediction", placeholder="Result will appear here")
|
| 37 |
-
|
| 38 |
-
classify_button.click(fn=classify_image, inputs=[image_input], outputs=[output_text])
|
| 39 |
-
|
| 40 |
-
demo.launch(debug=True)
|
| 41 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|