File size: 1,132 Bytes
f4c57c5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import gradio as gr
import joblib

def compute_trust_score(age, tcpa, adcopy, distance, lead_rate):

  dict_weight = {
      'age' : 0.001354,
      'tcpa' : 0.372240,
      'adcopy' : 0.296214,
      'distance' : 0.320232,
      'rate' : 0.009961
  }

  # Example computation for trust score (you can replace this with your actual computation)
  data_age = age * dict_weight['age']
  data_tcpa = tcpa * dict_weight['tcpa']
  data_adcopy = adcopy * dict_weight['adcopy']
  data_distance = distance * dict_weight['distance']
  data_rate = lead_rate * dict_weight['rate']
  
  lgbm = joblib.load('lgbm_model.joblib')

  trust_score = lgbm.predict([[data_age, data_tcpa, data_adcopy, data_distance, data_rate]])

  return trust_score

inputs = [
    gr.Number(label="Age"),
    gr.Number(label="TCPA Percentage"),
    gr.Number(label="Adcopy Percentage"),
    gr.Number(label="Mean Lead Distance"),
    gr.Number(label="Daily Average")
]

output = gr.Textbox(label="Trust Score")

iface = gr.Interface(fn=compute_trust_score, inputs=inputs, outputs=output, title="Trust Score Calculator")

if __name__ == "__main__":
    iface.launch()