Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,3 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
|
| 3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#import gradio as gr
|
| 2 |
+
|
| 3 |
+
#gr.Interface.load("models/nota-ai/bk-sdm-small").launch()
|
| 4 |
import gradio as gr
|
| 5 |
|
| 6 |
+
# List of twenty animals and wildlife native to Minnesota
|
| 7 |
+
animals = [
|
| 8 |
+
"White-tailed deer", "Moose", "Bobcat", "Coyote", "Red fox",
|
| 9 |
+
"Eastern gray squirrel", "American black bear", "Bald eagle", "Great horned owl", "Wild turkey",
|
| 10 |
+
"Canada goose", "Mallard duck", "Eastern bluebird", "Northern pike", "Walleye",
|
| 11 |
+
"Common loon", "Snowshoe hare", "Red-tailed hawk", "Beaver", "Eastern chipmunk"
|
| 12 |
+
]
|
| 13 |
+
|
| 14 |
+
def model_output(animal_name):
|
| 15 |
+
# Assuming the model accepts a string as input and returns some information about the animal
|
| 16 |
+
model = gr.Interface.load("models/nota-ai/bk-sdm-small")
|
| 17 |
+
return model(animal_name)[0]
|
| 18 |
+
|
| 19 |
+
interface = gr.Interface(
|
| 20 |
+
fn=model_output, # function to call on user input
|
| 21 |
+
inputs=gr.inputs.Dropdown(choices=animals, label="Select an Animal"),
|
| 22 |
+
outputs="text",
|
| 23 |
+
live=True # updates output without needing to click a button
|
| 24 |
+
)
|
| 25 |
+
|
| 26 |
+
interface.launch()
|