runaksh commited on
Commit
95716e3
·
verified ·
1 Parent(s): 0c5b3f3

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +19 -1
app.py CHANGED
@@ -2,4 +2,22 @@ from transformers import ViTFeatureExtractor, ViTModel
2
  from PIL import Image
3
  import requests
4
 
5
- runaksh/chest_xray_pneumonia_detection
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
  from PIL import Image
3
  import requests
4
 
5
+ loaded_model = AutoModelForSequenceClassification.from_pretrained("runaksh/chest_xray_pneumonia_detection")
6
+
7
+ pipe = pipeline('image-classification', model=model_name, device=0)
8
+
9
+ # Create title, description and article strings
10
+ title = "Classification Demo"
11
+ description = "XRay classification"
12
+
13
+ # Create the Gradio demo
14
+ demo = gr.Interface(fn=pipe, # mapping function from input to output
15
+ inputs=gr.Image(type='filepath'), # what are the inputs?
16
+ outputs=[gr.Label(label="Predictions"), # what are the outputs?
17
+ gr.Number(label="Prediction time (s)")], # our fn has two outputs, therefore we have two outputs
18
+ examples=example_list,
19
+ title=title,
20
+ description=description,)
21
+
22
+ # Launch the demo!
23
+ demo.launch()