MasterAlex69 commited on
Commit
572d42e
·
verified ·
1 Parent(s): f98d895

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +22 -1
app.py CHANGED
@@ -1,3 +1,4 @@
 
1
  import gradio as gr
2
  from transformers import pipeline, GPT2Tokenizer, AutoModelForSequenceClassification, AutoTokenizer
3
  from IPython.display import clear_output
@@ -240,4 +241,24 @@ with gr.Blocks(theme = gr.themes.Monochrome()) as iface:
240
  bn_test_d_1.click(fn = d_test_1, inputs = bn_test_d_1_text_input, outputs = bn_test_d_1_text_output)
241
 
242
  clear_output()
243
- iface.launch(share = True, debug = False)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ '''
2
  import gradio as gr
3
  from transformers import pipeline, GPT2Tokenizer, AutoModelForSequenceClassification, AutoTokenizer
4
  from IPython.display import clear_output
 
241
  bn_test_d_1.click(fn = d_test_1, inputs = bn_test_d_1_text_input, outputs = bn_test_d_1_text_output)
242
 
243
  clear_output()
244
+ iface.launch(share = True, debug = False)
245
+ '''
246
+
247
+ import gradio as gr
248
+ from transformers import pipeline
249
+
250
+ pipeline = pipeline(task="image-classification", model="julien-c/hotdog-not-hotdog")
251
+
252
+ def predict(input_img):
253
+ predictions = pipeline(input_img)
254
+ return input_img, {p["label"]: p["score"] for p in predictions}
255
+
256
+ gradio_app = gr.Interface(
257
+ predict,
258
+ inputs=gr.Image(label="Select hot dog candidate", sources=['upload', 'webcam'], type="pil"),
259
+ outputs=[gr.Image(label="Processed Image"), gr.Label(label="Result", num_top_classes=2)],
260
+ title="Hot Dog? Or Not?",
261
+ )
262
+
263
+ if __name__ == "__main__":
264
+ gradio_app.launch()