Spaces:
Sleeping
Sleeping
Pranomvignesh
commited on
Commit
·
419e1eb
1
Parent(s):
7901ba4
Prepared space
Browse files- .DS_Store +0 -0
- app.py +51 -21
- examples/.DS_Store +0 -0
- examples/sample_1.jpg +0 -0
- examples/sample_2.jpg +0 -0
- examples/sample_3.jpg +0 -0
- examples/sample_4.jpg +0 -0
- examples/sample_5.jpg +0 -0
- examples/sample_6.jpg +0 -0
- examples/sample_7.jpg +0 -0
- examples/sample_8.jpg +0 -0
- requirements.txt +4 -3
.DS_Store
ADDED
Binary file (6.15 kB). View file
|
|
app.py
CHANGED
@@ -1,22 +1,52 @@
|
|
1 |
import gradio as gr
|
2 |
-
import
|
3 |
-
import
|
4 |
-
from
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
import gradio as gr
|
2 |
+
import yolov5
|
3 |
+
import os
|
4 |
+
from transformers import pipeline
|
5 |
+
|
6 |
+
imageClassifier = pipeline(task="image-classification",
|
7 |
+
model="Ara88/timri-model")
|
8 |
+
|
9 |
+
model = yolov5.load('./gentle-meadow.pt', device="cpu")
|
10 |
+
|
11 |
+
def predict(image):
|
12 |
+
# results = model([image], size=224)
|
13 |
+
predictions = imageClassifier(image)
|
14 |
+
print(predictions)
|
15 |
+
|
16 |
+
return predictions
|
17 |
+
|
18 |
+
|
19 |
+
title = "Detecting Tumors in MRI Images"
|
20 |
+
description = """
|
21 |
+
Try the examples at bottom to get started.
|
22 |
+
"""
|
23 |
+
examples = [
|
24 |
+
[os.path.join(os.path.abspath(''), './examples/sample_1.png')],
|
25 |
+
[os.path.join(os.path.abspath(''), './examples/sample_2.png')],
|
26 |
+
[os.path.join(os.path.abspath(''), './examples/sample_3.jpg')],
|
27 |
+
[os.path.join(os.path.abspath(''), './examples/sample_4.jpg')],
|
28 |
+
[os.path.join(os.path.abspath(''), './examples/sample_5.jpg')],
|
29 |
+
[os.path.join(os.path.abspath(''), './examples/sample_6.jpg')],
|
30 |
+
[os.path.join(os.path.abspath(''), './examples/sample_7.jpg')],
|
31 |
+
[os.path.join(os.path.abspath(''), './examples/sample_8.jpg')],
|
32 |
+
]
|
33 |
+
|
34 |
+
inputs = gr.Image(type="pil", shape=(224, 224),
|
35 |
+
label="Upload your image for detection")
|
36 |
+
|
37 |
+
outputs = [
|
38 |
+
# gr.Image(type="pil", label="Tumor Detections"),
|
39 |
+
gr.Label(label="Tumor Classification")
|
40 |
+
]
|
41 |
+
|
42 |
+
interface = gr.Interface(
|
43 |
+
fn=predict,
|
44 |
+
inputs=inputs,
|
45 |
+
outputs=outputs,
|
46 |
+
title=title,
|
47 |
+
examples=examples,
|
48 |
+
description=description,
|
49 |
+
cache_examples=True,
|
50 |
+
theme='huggingface'
|
51 |
+
)
|
52 |
+
interface.launch(debug=True, enable_queue=True)
|
examples/.DS_Store
ADDED
Binary file (6.15 kB). View file
|
|
examples/sample_1.jpg
ADDED
![]() |
examples/sample_2.jpg
ADDED
![]() |
examples/sample_3.jpg
ADDED
![]() |
examples/sample_4.jpg
ADDED
![]() |
examples/sample_5.jpg
ADDED
![]() |
examples/sample_6.jpg
ADDED
![]() |
examples/sample_7.jpg
ADDED
![]() |
examples/sample_8.jpg
ADDED
![]() |
requirements.txt
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
-
gradio
|
2 |
torch
|
3 |
-
|
4 |
-
|
|
|
|
|
|
|
|
1 |
torch
|
2 |
+
yolov5
|
3 |
+
transformers
|
4 |
+
opencv-python
|
5 |
+
gradio
|