Saahil-doryu commited on
Commit
aab4568
·
verified ·
1 Parent(s): 99c0294

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -10
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
- # Define the Gradio function
8
  def classify_image(image):
9
  return run_inference(image, net_feat, net_cls)
10
 
11
- # Example image for demo
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"), # Pass image file paths
18
- outputs=gr.Textbox(label="Predicted clothing type:"), # Returns the predicted class name
19
  title="Clothing1M Classifier",
20
  description="Upload an image of clothing image.",
21
- examples=example_images # Provides a sample of images for testing
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()