jophex commited on
Commit
fc440c4
·
verified ·
1 Parent(s): d917e1b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +44 -2
app.py CHANGED
@@ -1,6 +1,6 @@
1
- import gradio as gr
2
 
3
- gr.load("models/microsoft/Phi-3.5-mini-instruct", max_batch_size=1000).launch(share=True)
4
 
5
 
6
 
@@ -108,3 +108,45 @@ gr.load("models/microsoft/Phi-3.5-mini-instruct", max_batch_size=1000).launch(s
108
  # # Launch with sharing enabled
109
  # interface.launch(share=True)
110
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # import gradio as gr
2
 
3
+ # gr.load("models/microsoft/Phi-3.5-mini-instruct", max_batch_size=1000).launch(share=True)
4
 
5
 
6
 
 
108
  # # Launch with sharing enabled
109
  # interface.launch(share=True)
110
 
111
+
112
+
113
+
114
+
115
+ import gradio as gr
116
+ from transformers import pipeline
117
+
118
+ pipeline = pipeline(task="image-classification", model="julien-c/hotdog-not-hotdog")
119
+
120
+ def predict(input_img):
121
+ predictions = pipeline(input_img)
122
+ return input_img, {p["label"]: p["score"] for p in predictions}
123
+
124
+ gradio_app = gr.Interface(
125
+ predict,
126
+ inputs=gr.Image(label="Select hot dog candidate", sources=['upload', 'webcam'], type="pil"),
127
+ outputs=[gr.Image(label="Processed Image"), gr.Label(label="Result", num_top_classes=2)],
128
+ title="Hot Dog? Or Not?",
129
+ )
130
+
131
+ if __name__ == "__main__":
132
+ gradio_app.launch()
133
+
134
+
135
+
136
+
137
+
138
+
139
+
140
+
141
+
142
+
143
+
144
+
145
+
146
+
147
+
148
+
149
+
150
+
151
+
152
+