Spaces:
Sleeping
Sleeping
richardhcli commited on
Commit ·
a411ab7
1
Parent(s): 18f36fa
test1
Browse files
app.py
CHANGED
|
@@ -1,39 +1,42 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
-
from transformers import pipeline
|
| 3 |
|
| 4 |
-
pipeline = pipeline(task="image-classification", model="julien-c/hotdog-not-hotdog")
|
| 5 |
|
|
|
|
| 6 |
|
|
|
|
| 7 |
|
| 8 |
|
| 9 |
-
def predict(input_img):
|
| 10 |
-
predictions = pipeline(input_img)
|
| 11 |
-
return input_img, {p["label"]: p["score"] for p in predictions}
|
| 12 |
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
#=================================================
|
| 24 |
-
IsTutorial = True
|
| 25 |
|
| 26 |
-
import time
|
|
|
|
|
|
|
| 27 |
|
| 28 |
def greet(name):
|
| 29 |
-
return "Hello " + name + "!!" + f"Time now is {
|
| 30 |
|
| 31 |
demo = gr.Interface(fn=greet, inputs="text", outputs="text")
|
| 32 |
|
|
|
|
| 33 |
|
| 34 |
-
|
| 35 |
-
if
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
gradio_app.launch()
|
|
|
|
| 1 |
import gradio as gr
|
|
|
|
| 2 |
|
|
|
|
| 3 |
|
| 4 |
+
# from transformers import pipeline
|
| 5 |
|
| 6 |
+
# pipeline = pipeline(task="image-classification", model="julien-c/hotdog-not-hotdog")
|
| 7 |
|
| 8 |
|
|
|
|
|
|
|
|
|
|
| 9 |
|
| 10 |
+
|
| 11 |
+
# def predict(input_img):
|
| 12 |
+
# predictions = pipeline(input_img)
|
| 13 |
+
# return input_img, {p["label"]: p["score"] for p in predictions}
|
| 14 |
+
|
| 15 |
+
# gradio_app = gr.Interface(
|
| 16 |
+
# predict,
|
| 17 |
+
# inputs=gr.Image(label="Select hot dog candidate", sources=['upload', 'webcam'], type="pil"),
|
| 18 |
+
# outputs=[gr.Image(label="Processed Image"), gr.Label(label="Result", num_top_classes=2)],
|
| 19 |
+
# title="Hot Dog? Or Not?",
|
| 20 |
+
# )
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
#=================================================
|
|
|
|
| 26 |
|
| 27 |
+
# import time
|
| 28 |
+
# timenow = time.ctime()
|
| 29 |
+
timenow = "10:10 AM"
|
| 30 |
|
| 31 |
def greet(name):
|
| 32 |
+
return "Hello " + name + "!!" + f"Time now is {timenow}"
|
| 33 |
|
| 34 |
demo = gr.Interface(fn=greet, inputs="text", outputs="text")
|
| 35 |
|
| 36 |
+
demo.launch()
|
| 37 |
|
| 38 |
+
# if __name__ == "__main__":
|
| 39 |
+
# if IsTutorial:
|
| 40 |
+
# demo.launch()
|
| 41 |
+
# else:
|
| 42 |
+
# gradio_app.launch()
|
|
|