Update app.py
Browse files
app.py
CHANGED
|
@@ -6,6 +6,7 @@ import requests
|
|
| 6 |
import g4f
|
| 7 |
import time
|
| 8 |
import os
|
|
|
|
| 9 |
|
| 10 |
theme = gr.themes.Base(
|
| 11 |
primary_hue="cyan",
|
|
@@ -25,7 +26,11 @@ brain_tumor_classifier = pipeline("image-classification", model="Devarshi/Brain_
|
|
| 25 |
|
| 26 |
# Create a function to Detect/Classify Alzheimer
|
| 27 |
def classify_alzheimer(image):
|
| 28 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 29 |
prediction = result[0]
|
| 30 |
score = prediction['score']
|
| 31 |
label = prediction['label']
|
|
@@ -50,7 +55,11 @@ def classify_breast_cancer(image):
|
|
| 50 |
|
| 51 |
# Create a function to Detect/Classify Brain_Tumor
|
| 52 |
def classify_brain_tumor(image):
|
| 53 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 54 |
prediction = result[0]
|
| 55 |
score = prediction['score']
|
| 56 |
label = prediction['label']
|
|
|
|
| 6 |
import g4f
|
| 7 |
import time
|
| 8 |
import os
|
| 9 |
+
import base64
|
| 10 |
|
| 11 |
theme = gr.themes.Base(
|
| 12 |
primary_hue="cyan",
|
|
|
|
| 26 |
|
| 27 |
# Create a function to Detect/Classify Alzheimer
|
| 28 |
def classify_alzheimer(image):
|
| 29 |
+
with open(image, 'rb') as img:
|
| 30 |
+
encoded_string = base64.b64encode(img.read())
|
| 31 |
+
image_base = encoded_string.decode('utf-8')
|
| 32 |
+
|
| 33 |
+
result = alzheimer_classifier(image_base)
|
| 34 |
prediction = result[0]
|
| 35 |
score = prediction['score']
|
| 36 |
label = prediction['label']
|
|
|
|
| 55 |
|
| 56 |
# Create a function to Detect/Classify Brain_Tumor
|
| 57 |
def classify_brain_tumor(image):
|
| 58 |
+
with open(image, 'rb') as img:
|
| 59 |
+
encoded_string = base64.b64encode(img.read())
|
| 60 |
+
image_base = encoded_string.decode('utf-8')
|
| 61 |
+
|
| 62 |
+
result = brain_tumor_classifier(image_base)
|
| 63 |
prediction = result[0]
|
| 64 |
score = prediction['score']
|
| 65 |
label = prediction['label']
|