abhicodes commited on
Commit
6233aa1
1 Parent(s): e421fe6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -8
app.py CHANGED
@@ -26,11 +26,7 @@ brain_tumor_classifier = pipeline("image-classification", model="Devarshi/Brain_
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']
@@ -72,7 +68,7 @@ with gr.Blocks(theme=theme) as Alzheimer:
72
  with gr.Column():
73
  gr.Markdown("# Alzheimer Detection and Classification")
74
  gr.Markdown("> Classify the alzheimer into Mild Demented, Very Mild Demented, Moderate Demented and Non Demented.")
75
- image = gr.Image()
76
  output = gr.Label(label='Alzheimer Classification', container=True, scale=2)
77
  with gr.Row():
78
  gr.ClearButton([image, output])
@@ -105,7 +101,7 @@ with gr.Blocks(theme=theme) as BreastCancer:
105
  with gr.Column():
106
  gr.Markdown("# Breast Cancer Detection and Classification")
107
  gr.Markdown("> Classify the breast cancer.")
108
- image = gr.Image()
109
  output = gr.Label(label='Breast Cancer Classification', container=True, scale=2)
110
  with gr.Row():
111
  button = gr.Button(value="Submit", variant="primary")
@@ -139,7 +135,7 @@ with gr.Blocks(theme=theme) as BrainTumor:
139
  with gr.Column():
140
  gr.Markdown("# Brain Tumor Detection and Classification")
141
  gr.Markdown("> Classify the Brain Tumor.")
142
- image = gr.Image()
143
  output = gr.Label(label='Brain_Tumor Classification', container=True, scale=2)
144
  with gr.Row():
145
  button = gr.Button(value="Submit", variant="primary")
 
26
 
27
  # Create a function to Detect/Classify Alzheimer
28
  def classify_alzheimer(image):
29
+ result = alzheimer_classifier(image)
 
 
 
 
30
  prediction = result[0]
31
  score = prediction['score']
32
  label = prediction['label']
 
68
  with gr.Column():
69
  gr.Markdown("# Alzheimer Detection and Classification")
70
  gr.Markdown("> Classify the alzheimer into Mild Demented, Very Mild Demented, Moderate Demented and Non Demented.")
71
+ image = gr.Image(type="pil")
72
  output = gr.Label(label='Alzheimer Classification', container=True, scale=2)
73
  with gr.Row():
74
  gr.ClearButton([image, output])
 
101
  with gr.Column():
102
  gr.Markdown("# Breast Cancer Detection and Classification")
103
  gr.Markdown("> Classify the breast cancer.")
104
+ image = gr.Image(type="pil")
105
  output = gr.Label(label='Breast Cancer Classification', container=True, scale=2)
106
  with gr.Row():
107
  button = gr.Button(value="Submit", variant="primary")
 
135
  with gr.Column():
136
  gr.Markdown("# Brain Tumor Detection and Classification")
137
  gr.Markdown("> Classify the Brain Tumor.")
138
+ image = gr.Image(type="pil")
139
  output = gr.Label(label='Brain_Tumor Classification', container=True, scale=2)
140
  with gr.Row():
141
  button = gr.Button(value="Submit", variant="primary")