Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
import gradio as gr
|
2 |
from transformers import pipeline
|
3 |
from PIL import Image
|
4 |
-
import os
|
5 |
|
6 |
def load_images_from_current_directory():
|
7 |
images = []
|
@@ -15,7 +15,7 @@ def load_images_from_current_directory():
|
|
15 |
return images
|
16 |
|
17 |
# Example: Load images from the current directory
|
18 |
-
example_images = load_images_from_current_directory()
|
19 |
|
20 |
# Define the image classification function
|
21 |
def classify_image(image):
|
@@ -57,11 +57,11 @@ article = "<p style='text-align: center'>Image Classification | Demo Model</p>"
|
|
57 |
|
58 |
|
59 |
# Prepare examples with loaded images
|
60 |
-
examples = []
|
61 |
-
for img in example_images:
|
62 |
-
examples.append([np.array(img), os.path.basename(os.path.splitext(img.filename)[0])])
|
63 |
|
64 |
-
demo = gr.Interface(fn=classify_image, inputs=image, outputs=label, description=description, article=article, title=title
|
65 |
|
66 |
# Launch the Gradio interface
|
67 |
demo.launch()
|
|
|
1 |
import gradio as gr
|
2 |
from transformers import pipeline
|
3 |
from PIL import Image
|
4 |
+
#import os
|
5 |
|
6 |
def load_images_from_current_directory():
|
7 |
images = []
|
|
|
15 |
return images
|
16 |
|
17 |
# Example: Load images from the current directory
|
18 |
+
#example_images = load_images_from_current_directory()
|
19 |
|
20 |
# Define the image classification function
|
21 |
def classify_image(image):
|
|
|
57 |
|
58 |
|
59 |
# Prepare examples with loaded images
|
60 |
+
#examples = []
|
61 |
+
#for img in example_images:
|
62 |
+
# examples.append([np.array(img), os.path.basename(os.path.splitext(img.filename)[0])])
|
63 |
|
64 |
+
demo = gr.Interface(fn=classify_image, inputs=image, outputs=label, description=description, article=article, title=title)
|
65 |
|
66 |
# Launch the Gradio interface
|
67 |
demo.launch()
|