Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,27 +1,22 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
from inference import load_model, run_inference
|
| 3 |
|
| 4 |
-
# Load the model once when the app starts
|
| 5 |
net_feat, net_cls = load_model()
|
| 6 |
|
| 7 |
-
|
| 8 |
def classify_image(image):
|
| 9 |
return run_inference(image, net_feat, net_cls)
|
| 10 |
|
| 11 |
-
|
| 12 |
-
example_images = ["example.jpeg", "example2.webp","image1.jpeg"]
|
| 13 |
|
| 14 |
-
# Create the Gradio Interface
|
| 15 |
interface = gr.Interface(
|
| 16 |
fn=classify_image,
|
| 17 |
-
inputs=gr.Image(type="filepath"),
|
| 18 |
-
outputs=gr.Textbox(label="Predicted clothing type:"),
|
| 19 |
title="Clothing1M Classifier",
|
| 20 |
description="Upload an image of clothing image.",
|
| 21 |
-
examples=example_images
|
| 22 |
)
|
| 23 |
|
| 24 |
-
|
| 25 |
-
# Launch the Gradio app
|
| 26 |
if __name__ == "__main__":
|
| 27 |
interface.launch()
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
from inference import load_model, run_inference
|
| 3 |
|
|
|
|
| 4 |
net_feat, net_cls = load_model()
|
| 5 |
|
| 6 |
+
|
| 7 |
def classify_image(image):
|
| 8 |
return run_inference(image, net_feat, net_cls)
|
| 9 |
|
| 10 |
+
example_images = ["example.jpeg", "example2.webp","image2.jpeg"]
|
|
|
|
| 11 |
|
|
|
|
| 12 |
interface = gr.Interface(
|
| 13 |
fn=classify_image,
|
| 14 |
+
inputs=gr.Image(type="filepath"),
|
| 15 |
+
outputs=gr.Textbox(label="Predicted clothing type:"),
|
| 16 |
title="Clothing1M Classifier",
|
| 17 |
description="Upload an image of clothing image.",
|
| 18 |
+
examples=example_images
|
| 19 |
)
|
| 20 |
|
|
|
|
|
|
|
| 21 |
if __name__ == "__main__":
|
| 22 |
interface.launch()
|