eligapris commited on
Commit
430b6a5
·
verified ·
1 Parent(s): a8282b4
Files changed (1) hide show
  1. app.py +28 -0
app.py ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from transformers import pipeline
3
+
4
+ # Initialize the image classification pipeline
5
+ pipe = pipeline("image-classification", model="eligapris/v-mdd-2000-150")
6
+
7
+ def classify_image(image):
8
+ # Perform image classification
9
+ results = pipe(image)
10
+
11
+ # Format the results
12
+ output = ""
13
+ for result in results:
14
+ output += f"Label: {result['label']}, Score: {result['score']:.4f}\n"
15
+
16
+ return output
17
+
18
+ # Create the Gradio interface
19
+ iface = gr.Interface(
20
+ fn=classify_image,
21
+ inputs=gr.Image(type="pil"),
22
+ outputs="text",
23
+ title="Image Classification",
24
+ description="Upload an image to classify it using the eligapris/v-mdd-2000-150 model."
25
+ )
26
+
27
+ # Launch the app
28
+ iface.launch(share=True)