Spaces:
Sleeping
Sleeping
| 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() |