Spaces:
Sleeping
Sleeping
[feat]: upload files
Browse files- deployment/gradio/app.py +2 -2
- src/infer.py +1 -4
deployment/gradio/app.py
CHANGED
|
@@ -27,7 +27,7 @@ def classify_image(
|
|
| 27 |
try:
|
| 28 |
prediction = inference_pipeline(
|
| 29 |
image_path=image_path,
|
| 30 |
-
model_path=model_path
|
| 31 |
)
|
| 32 |
return f"Prediction: {prediction.capitalize()}"
|
| 33 |
except Exception as e:
|
|
@@ -48,5 +48,5 @@ with gr.Blocks() as demo:
|
|
| 48 |
|
| 49 |
classify_button.click(fn=classify_image, inputs=[image_input], outputs=[output_text])
|
| 50 |
|
| 51 |
-
demo.launch(debug=True)
|
| 52 |
|
|
|
|
| 27 |
try:
|
| 28 |
prediction = inference_pipeline(
|
| 29 |
image_path=image_path,
|
| 30 |
+
model_path=model_path
|
| 31 |
)
|
| 32 |
return f"Prediction: {prediction.capitalize()}"
|
| 33 |
except Exception as e:
|
|
|
|
| 48 |
|
| 49 |
classify_button.click(fn=classify_image, inputs=[image_input], outputs=[output_text])
|
| 50 |
|
| 51 |
+
demo.launch(share=True, debug=True)
|
| 52 |
|
src/infer.py
CHANGED
|
@@ -1,13 +1,10 @@
|
|
| 1 |
import torch
|
| 2 |
-
from typing import Optional
|
| 3 |
-
from huggingface_hub import hf_hub_download
|
| 4 |
from src.model import CatDogClassifier
|
| 5 |
from src.config import CatDogClassifierConfigs
|
| 6 |
|
| 7 |
def inference_pipeline(
|
| 8 |
image_path: str = "datasets/single_prediction/cat_or_dog_1.jpg",
|
| 9 |
-
model_path: str = "checkpoints/ckpt_23_10_2025/best_cat_dog_classifier_model_20251019_122336.pth"
|
| 10 |
-
hf: bool = False
|
| 11 |
):
|
| 12 |
|
| 13 |
# Initialize model
|
|
|
|
| 1 |
import torch
|
|
|
|
|
|
|
| 2 |
from src.model import CatDogClassifier
|
| 3 |
from src.config import CatDogClassifierConfigs
|
| 4 |
|
| 5 |
def inference_pipeline(
|
| 6 |
image_path: str = "datasets/single_prediction/cat_or_dog_1.jpg",
|
| 7 |
+
model_path: str = "checkpoints/ckpt_23_10_2025/best_cat_dog_classifier_model_20251019_122336.pth"
|
|
|
|
| 8 |
):
|
| 9 |
|
| 10 |
# Initialize model
|