Sordhiq commited on
Commit
042b667
1 Parent(s): 6a738cd

Create model_deployment

Browse files
Files changed (1) hide show
  1. model_deployment +83 -0
model_deployment ADDED
@@ -0,0 +1,83 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import numpy as np
2
+ import pickle
3
+ import pandas as pd
4
+ #import streamlit as st
5
+ import gradio as gr
6
+
7
+
8
+ with open("DTHabitatClassifier.pkl","rb") as pickle_in:
9
+ classifier=pickle.load(pickle_in)
10
+
11
+
12
+ def welcome():
13
+ return "Welcome All"
14
+
15
+ def habitat(species, processid, marker_code, gb_acs, nucraw , levenshtein_distance):
16
+
17
+ """Let's load in the features as argument
18
+ This is using docstrings for specifications.
19
+ ---
20
+ parameters:
21
+ - name: species
22
+ in: query
23
+ type: number
24
+ required: true
25
+ - name: processid
26
+ in: query
27
+ type: number
28
+ required: true
29
+ - name: marker_code
30
+ in: query
31
+ type: number
32
+ required: true
33
+ - name: gb_acs
34
+ in: query
35
+ type: number
36
+ required: true
37
+ - name: nucraw
38
+ in: query
39
+ type: number
40
+ required: true
41
+ - name: levenshtein_distance
42
+ in: query
43
+ type: number
44
+ required: true
45
+ responses:
46
+ 200:
47
+ description: The output values
48
+
49
+ """
50
+
51
+ prediction=classifier.predict([[species, processid, marker_code, gb_acs, nucraw, levenshtein_distance]])
52
+ print(prediction)
53
+ return prediction
54
+
55
+
56
+
57
+ def main():
58
+ st.title("eDNA Habitat Classification")
59
+ html_temp = """
60
+ <div style="background-color:tomato;padding:10px">
61
+ <h2 style="color:white;text-align:center;">eDNA Habitat Classification App </h2>
62
+ </div>
63
+ """
64
+
65
+ """Proudly, Team SpaceM!"""
66
+
67
+
68
+ st.markdown(html_temp,unsafe_allow_html=True)
69
+ species = st.text_input("Species")
70
+ processid = st.text_input("Processid")
71
+ marker_code = st.text_input("Marker Code")
72
+ gb_acs = st.text_input("GB_ACS")
73
+ nucraw = st.text_input("Nucraw")
74
+ levenshtein_distance = st.text_input("Levenshtein Distance")
75
+ result=""
76
+ if st.button("Classify"):
77
+ result=habitat(species, processid, marker_code, gb_acs, nucraw, levenshtein_distance)
78
+ st.success(f'The output is {result}')
79
+ if st.button("About"):
80
+ st.text("Many thanks")
81
+
82
+ if __name__=='__main__':
83
+ main()