Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,3 +1,17 @@
|
|
|
|
1 |
import gradio as gr
|
|
|
2 |
|
3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
gr.Interface.load("").launch()
|
2 |
import gradio as gr
|
3 |
+
from transformers import pipeline
|
4 |
|
5 |
+
pipeline = pipeline(task="image-classification", model="models/ppicazo/moon-detector-v5")
|
6 |
+
|
7 |
+
def predict(image):
|
8 |
+
predictions = pipeline(image)
|
9 |
+
return {p["label"]: p["score"] for p in predictions}
|
10 |
+
|
11 |
+
gr.Interface(
|
12 |
+
predict,
|
13 |
+
inputs=gr.Image(shape=(1080, None), type="pil", label="Upload image"),
|
14 |
+
outputs=gr.Label(num_top_classes=5),
|
15 |
+
title="Moon Detector",
|
16 |
+
allow_flagging="manual",
|
17 |
+
).launch()
|