Adipta commited on
Commit
f4c57c5
1 Parent(s): 4c236cb

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +40 -0
app.py ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ import joblib
3
+
4
+ def compute_trust_score(age, tcpa, adcopy, distance, lead_rate):
5
+
6
+ dict_weight = {
7
+ 'age' : 0.001354,
8
+ 'tcpa' : 0.372240,
9
+ 'adcopy' : 0.296214,
10
+ 'distance' : 0.320232,
11
+ 'rate' : 0.009961
12
+ }
13
+
14
+ # Example computation for trust score (you can replace this with your actual computation)
15
+ data_age = age * dict_weight['age']
16
+ data_tcpa = tcpa * dict_weight['tcpa']
17
+ data_adcopy = adcopy * dict_weight['adcopy']
18
+ data_distance = distance * dict_weight['distance']
19
+ data_rate = lead_rate * dict_weight['rate']
20
+
21
+ lgbm = joblib.load('lgbm_model.joblib')
22
+
23
+ trust_score = lgbm.predict([[data_age, data_tcpa, data_adcopy, data_distance, data_rate]])
24
+
25
+ return trust_score
26
+
27
+ inputs = [
28
+ gr.Number(label="Age"),
29
+ gr.Number(label="TCPA Percentage"),
30
+ gr.Number(label="Adcopy Percentage"),
31
+ gr.Number(label="Mean Lead Distance"),
32
+ gr.Number(label="Daily Average")
33
+ ]
34
+
35
+ output = gr.Textbox(label="Trust Score")
36
+
37
+ iface = gr.Interface(fn=compute_trust_score, inputs=inputs, outputs=output, title="Trust Score Calculator")
38
+
39
+ if __name__ == "__main__":
40
+ iface.launch()