|
import numpy as np |
|
import pickle |
|
import pandas as pd |
|
|
|
import gradio as gr |
|
|
|
|
|
with open("DTHabitatClassifier.pkl","rb") as pickle_in: |
|
classifier=pickle.load(pickle_in) |
|
|
|
|
|
def welcome(): |
|
return "Welcome All" |
|
|
|
def habitat(species, processid, marker_code, gb_acs, nucraw , levenshtein_distance): |
|
|
|
"""Let's load in the features as argument |
|
This is using docstrings for specifications. |
|
--- |
|
parameters: |
|
- name: species |
|
in: query |
|
type: number |
|
required: true |
|
- name: processid |
|
in: query |
|
type: number |
|
required: true |
|
- name: marker_code |
|
in: query |
|
type: number |
|
required: true |
|
- name: gb_acs |
|
in: query |
|
type: number |
|
required: true |
|
- name: nucraw |
|
in: query |
|
type: number |
|
required: true |
|
- name: levenshtein_distance |
|
in: query |
|
type: number |
|
required: true |
|
responses: |
|
200: |
|
description: The output values |
|
|
|
""" |
|
|
|
prediction=classifier.predict([[species, processid, marker_code, gb_acs, nucraw, levenshtein_distance]]) |
|
print(prediction) |
|
return prediction |
|
|
|
|
|
|
|
def main(): |
|
st.title("eDNA Habitat Classification") |
|
html_temp = """ |
|
<div style="background-color:tomato;padding:10px"> |
|
<h2 style="color:white;text-align:center;">eDNA Habitat Classification App </h2> |
|
</div> |
|
""" |
|
|
|
"""Proudly, Team SpaceM!""" |
|
|
|
|
|
st.markdown(html_temp,unsafe_allow_html=True) |
|
species = st.text_input("Species") |
|
processid = st.text_input("Processid") |
|
marker_code = st.text_input("Marker Code") |
|
gb_acs = st.text_input("GB_ACS") |
|
nucraw = st.text_input("Nucraw") |
|
levenshtein_distance = st.text_input("Levenshtein Distance") |
|
result="" |
|
if st.button("Classify"): |
|
result=habitat(species, processid, marker_code, gb_acs, nucraw, levenshtein_distance) |
|
st.success(f'The output is {result}') |
|
if st.button("About"): |
|
st.text("Many thanks") |
|
|
|
if __name__=='__main__': |
|
main() |
|
|