Spaces:
Runtime error
Runtime error
root
commited on
Commit
·
6a38c63
1
Parent(s):
4ac11df
all files
Browse files- Makefile +27 -0
- app.py +27 -0
- examples-jpg/example_image1.png +0 -0
- examples-jpg/example_image2.jpg +0 -0
- examples-jpg/example_image3.jpg +0 -0
- requirements.txt +1 -0
Makefile
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
install:
|
| 2 |
+
pip install --upgrade pip &&\
|
| 3 |
+
pip install -r requirements.txt
|
| 4 |
+
|
| 5 |
+
test:
|
| 6 |
+
python -m pytest -vvv --cov=hello --cov=greeting \
|
| 7 |
+
--cov=smath --cov=web tests
|
| 8 |
+
python -m pytest --nbval notebook.ipynb #tests our jupyter notebook
|
| 9 |
+
#python -m pytest -v tests/test_web.py #if you just want to test web
|
| 10 |
+
|
| 11 |
+
debug:
|
| 12 |
+
python -m pytest -vv --pdb #Debugger is invoked
|
| 13 |
+
|
| 14 |
+
one-test:
|
| 15 |
+
python -m pytest -vv tests/test_greeting.py::test_my_name4
|
| 16 |
+
|
| 17 |
+
debugthree:
|
| 18 |
+
#not working the way I expect
|
| 19 |
+
python -m pytest -vv --pdb --maxfail=4 # drop to PDB for first three failures
|
| 20 |
+
|
| 21 |
+
format:
|
| 22 |
+
black *.py
|
| 23 |
+
|
| 24 |
+
lint:
|
| 25 |
+
pylint --disable=R,C *.py
|
| 26 |
+
|
| 27 |
+
all: install lint test format
|
app.py
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
|
| 3 |
+
transformer_model = "huggingface/google/vit-base-patch16-224"
|
| 4 |
+
Instructuction = "Browse the internet to download any unique image"
|
| 5 |
+
title="Simple Image classification playground"
|
| 6 |
+
description = "Drop an image to classify, then observe how the machine learning model\
|
| 7 |
+
is able to show the percentages for different class predictions made."
|
| 8 |
+
article = """
|
| 9 |
+
- Select an image from the examples provided as demo image
|
| 10 |
+
- Click submit button to make Image classification
|
| 11 |
+
- Click clear button to try new Image for classification
|
| 12 |
+
"""
|
| 13 |
+
|
| 14 |
+
# Gradio app design
|
| 15 |
+
interface = gr.Interface.load(
|
| 16 |
+
transformer_model,
|
| 17 |
+
title = title,
|
| 18 |
+
description = description,
|
| 19 |
+
article = article,
|
| 20 |
+
allow_flagging = "never",
|
| 21 |
+
theme = "peach",
|
| 22 |
+
live = False,
|
| 23 |
+
examples=["examples-jpg/example_image1.png",
|
| 24 |
+
"examples-jpg/example_image2.jpg",
|
| 25 |
+
"examples-jpg/example_image3.jpg"]
|
| 26 |
+
)
|
| 27 |
+
interface.launch()
|
examples-jpg/example_image1.png
ADDED
|
examples-jpg/example_image2.jpg
ADDED
|
examples-jpg/example_image3.jpg
ADDED
|
requirements.txt
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
gradio
|