Sort the Example files alphabetically so in right order fix a bug missing import
Browse files
app.py
CHANGED
@@ -1,5 +1,7 @@
|
|
1 |
import gradio as gr
|
2 |
import glob
|
|
|
|
|
3 |
|
4 |
def classify_image(image):
|
5 |
# Wait for a random interval between 0.5 and 1.5 seconds to look useful
|
@@ -9,7 +11,7 @@ def classify_image(image):
|
|
9 |
return "Not a bird"
|
10 |
|
11 |
# Dynamically create the list of example images
|
12 |
-
example_files = glob.glob("examples/*.png")
|
13 |
examples = [[file] for file in example_files]
|
14 |
|
15 |
# Create the Gradio interface
|
@@ -18,8 +20,8 @@ demo = gr.Interface(
|
|
18 |
inputs="image", # The input type is an image
|
19 |
outputs="text", # The output type is text
|
20 |
examples=examples # Add example images
|
21 |
-
title="Is this a picture of a bird?"
|
22 |
-
description="Uses the latest in machine learning LLM Diffusion models to analyzes every pixel (twice) and to determine conclusively if it is a picture of a bird" # Description of the app
|
23 |
)
|
24 |
# Launch the app
|
25 |
demo.launch()
|
|
|
1 |
import gradio as gr
|
2 |
import glob
|
3 |
+
import time
|
4 |
+
import random
|
5 |
|
6 |
def classify_image(image):
|
7 |
# Wait for a random interval between 0.5 and 1.5 seconds to look useful
|
|
|
11 |
return "Not a bird"
|
12 |
|
13 |
# Dynamically create the list of example images
|
14 |
+
example_files = sorted(glob.glob("examples/*.png"))
|
15 |
examples = [[file] for file in example_files]
|
16 |
|
17 |
# Create the Gradio interface
|
|
|
20 |
inputs="image", # The input type is an image
|
21 |
outputs="text", # The output type is text
|
22 |
examples=examples # Add example images
|
23 |
+
,title="Is this a picture of a bird?" # Title of the app
|
24 |
+
,description="Uses the latest in machine learning LLM Diffusion models to analyzes every pixel (twice) and to determine conclusively if it is a picture of a bird" # Description of the app
|
25 |
)
|
26 |
# Launch the app
|
27 |
demo.launch()
|