Hamda commited on
Commit
1549b96
1 Parent(s): 2291a30

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -13
app.py CHANGED
@@ -65,19 +65,21 @@ if (st.button('استعمال الرسم البياني', disabled=False)):
65
  return list(set(res))
66
 
67
  L = setQueriesVoc(df_in, id_list)
68
-
69
- for nc in L:
70
- score = 0.0
71
- temp = []
72
- for ni in id_list:
73
- try:
74
- score = score + df_g.loc[(ni, nc),'score']
75
- except KeyError:
76
- continue
77
- key = df3.loc[nc].values[0]
78
- tmt[key] = score
79
-
80
-
 
 
81
  exp_terms = []
82
  t_li = tmt.values()
83
  tmexp = sorted(tmt.items(), key=lambda x: x[1], reverse=True)
 
65
  return list(set(res))
66
 
67
  L = setQueriesVoc(df_in, id_list)
68
+ @st.cache
69
+ def compute_score(L, id_list)
70
+ for nc in L:
71
+ score = 0.0
72
+ temp = []
73
+ for ni in id_list:
74
+ try:
75
+ score = score + df_g.loc[(ni, nc),'score']
76
+ except KeyError:
77
+ continue
78
+ key = df3.loc[nc].values[0]
79
+ tmt[key] = score
80
+ return tmt
81
+
82
+ tmt = compute_score(L, id_list)
83
  exp_terms = []
84
  t_li = tmt.values()
85
  tmexp = sorted(tmt.items(), key=lambda x: x[1], reverse=True)