Spaces:
Sleeping
Sleeping
Commit
·
164e46f
1
Parent(s):
36ea21a
Delete app.py
Browse files
app.py
DELETED
@@ -1,37 +0,0 @@
|
|
1 |
-
import gradio as gr
|
2 |
-
from transformers import pipeline
|
3 |
-
|
4 |
-
model = pipeline(task="image-classification", model="julien-c/hotdog-not-hotdog")
|
5 |
-
def predict(image):
|
6 |
-
# Define your prediction function here
|
7 |
-
# For example:
|
8 |
-
images = [image.crop((0, 0, 100, 100)), image.crop((100, 100, 200, 200))]
|
9 |
-
predictions = ['cat', 'dog']
|
10 |
-
return images, predictions
|
11 |
-
|
12 |
-
# Create Gradio interface
|
13 |
-
iface = gr.Interface(
|
14 |
-
fn=predict,
|
15 |
-
inputs=gr.inputs.Image(type='pil'),
|
16 |
-
outputs=[gr.outputs.Image(type='pil', label='Images'), gr.outputs.Label(label='Predictions')]
|
17 |
-
)
|
18 |
-
|
19 |
-
# Launch Gradio app
|
20 |
-
iface.launch()
|
21 |
-
|
22 |
-
# def predict(image):
|
23 |
-
# predictions = model(image)
|
24 |
-
# return {p["label"]: p["score"] for p in predictions}
|
25 |
-
|
26 |
-
# gr.Interface(
|
27 |
-
# predict,
|
28 |
-
# inputs=gr.inputs.Image(label="Upload hot dog candidate", type="filepath"),
|
29 |
-
# outputs=[gr.outputs.Image(type='pil', label='Image'), gr.outputs.Label(num_top_classes=2)], # gr.outputs.Label(num_top_classes=2),
|
30 |
-
# title="Hot Dog? Or Not?",
|
31 |
-
# ).launch()
|
32 |
-
|
33 |
-
# def greet(name):
|
34 |
-
# return "Hello " + name + "!!"
|
35 |
-
|
36 |
-
# iface = gr.Interface(fn=greet, inputs="text", outputs="text"+" is silly! :P")
|
37 |
-
# iface.launch()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|