Jether commited on
Update app.py
Browse files
app.py
CHANGED
|
@@ -64,3 +64,27 @@ demo = gr.ChatInterface(
|
|
| 64 |
|
| 65 |
if __name__ == "__main__":
|
| 66 |
demo.launch(share=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 64 |
|
| 65 |
if __name__ == "__main__":
|
| 66 |
demo.launch(share=True)
|
| 67 |
+
|
| 68 |
+
|
| 69 |
+
|
| 70 |
+
|
| 71 |
+
|
| 72 |
+
|
| 73 |
+
import gradio as gr
|
| 74 |
+
from transformers import pipeline
|
| 75 |
+
|
| 76 |
+
pipeline = pipeline(task="image-classification", model="jethermart/PGP")
|
| 77 |
+
|
| 78 |
+
def predict(input_img):
|
| 79 |
+
predictions = pipeline(input_img)
|
| 80 |
+
return input_img, {p["label"]: p["score"] for p in predictions}
|
| 81 |
+
|
| 82 |
+
gradio_app = gr.Interface(
|
| 83 |
+
predict,
|
| 84 |
+
inputs=gr.Image(label="Select hot dog candidate", sources=['upload', 'webcam'], type="pil"),
|
| 85 |
+
outputs=[gr.Image(label="Processed Image"), gr.Label(label="Result", num_top_classes=2)],
|
| 86 |
+
title="Hot Dog? Or Not?",
|
| 87 |
+
)
|
| 88 |
+
|
| 89 |
+
if __name__ == "__main__":
|
| 90 |
+
gradio_app.launch()
|