Spaces:
Runtime error
Runtime error
Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
import numpy as np
|
| 3 |
+
import pandas as pd
|
| 4 |
+
import tensorflow as tf
|
| 5 |
+
from tensorflow import keras
|
| 6 |
+
|
| 7 |
+
#loading the saved model
|
| 8 |
+
from keras.models import load_model
|
| 9 |
+
model = load_model('Model.h5')
|
| 10 |
+
|
| 11 |
+
|
| 12 |
+
def iris(Gender ,Hemoglobin, MCH, MCHC, MCV):
|
| 13 |
+
prediction = model_rfc.predict([[Gender ,Hemoglobin, MCH, MCHC, MCV]])
|
| 14 |
+
if (prediction[0] ==0):
|
| 15 |
+
return "Positive"
|
| 16 |
+
|
| 17 |
+
elif (prediction[0] ==1):
|
| 18 |
+
return "Negative"
|
| 19 |
+
else:
|
| 20 |
+
return "Error"
|
| 21 |
+
|
| 22 |
+
#create input and output objects
|
| 23 |
+
#input object1
|
| 24 |
+
input1 = gr.inputs.Number(label="Gender")
|
| 25 |
+
#input object 2
|
| 26 |
+
input2 = gr.inputs.Number(label="Hemoglobin")
|
| 27 |
+
#input object3
|
| 28 |
+
input3 = gr.inputs.Number(label="Mean Corpusular Hemoglobin (MCH)")
|
| 29 |
+
#input object 3
|
| 30 |
+
input4 = gr.inputs.Number(label="Mean Corpusular Hemoglobin Concentration (MCH")
|
| 31 |
+
#input object
|
| 32 |
+
input5 = gr.inputs.Number(label="Mean Corpusular Volume (MCV)")
|
| 33 |
+
|
| 34 |
+
output = gr.outputs.Textbox(label= "RESULT")
|
| 35 |
+
|
| 36 |
+
#create interface
|
| 37 |
+
gui = gr.Interface(fn=iris,
|
| 38 |
+
inputs=[input1, input2, input3, input4, input5],
|
| 39 |
+
outputs=output).launch(debug=True)
|