FDSRashid commited on
Commit
142c25c
·
verified ·
1 Parent(s): 7252c47

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -3
app.py CHANGED
@@ -118,12 +118,21 @@ def visualize_isnad(taraf_num, yaxis):
118
  student_gen = student_gen[0]
119
  else:
120
  student_gen = -1
121
-
 
 
 
 
 
 
 
 
 
122
  if row['Source'] == '99999':
123
  net.add_node(source, font = {'size':50, 'color': 'Black'}, color = '#000000', label = f'{row["Teacher"]}')
124
  else:
125
- net.add_node(source, font = {'size':30, 'color': 'red'}, color = value_to_hex(teacher_narrations), label = f'{row["Teacher"]} \n {teacher_info["Narrator Rank"].to_list()[0]} \n ID: {row["Source"]} - Gen {teacher_gen}')
126
- net.add_node(target, font = {'size': 30, 'color': 'red'}, color = value_to_hex(student_narrations), label = f'{row["Student"]} \n{student_info["Narrator Rank"].to_list()[0]} \n ID: {row["Destination"]} - Gen {student_gen}')
127
  net.add_edge(source, target, color = value_to_hex(int(row[f'{yaxis} Count'])), label = f"{row[f'{yaxis} Count']}")
128
  net.barnes_hut(gravity=-5000, central_gravity=0.3, spring_length=200)
129
  html = net.generate_html()
 
118
  student_gen = student_gen[0]
119
  else:
120
  student_gen = -1
121
+ teacher_rank = teacher_info["Narrator Rank"].to_list()
122
+ if len(teacher_rank):
123
+ teacher_rank = teacher_rank[0]
124
+ else:
125
+ teacher_rank = 'فلان'
126
+ student_rank = student_info["Narrator Rank"].to_list()
127
+ if len(student_rank):
128
+ student_rank = student_rank[0]
129
+ else:
130
+ student_rank = 'فلان'
131
  if row['Source'] == '99999':
132
  net.add_node(source, font = {'size':50, 'color': 'Black'}, color = '#000000', label = f'{row["Teacher"]}')
133
  else:
134
+ net.add_node(source, font = {'size':30, 'color': 'red'}, color = value_to_hex(teacher_narrations), label = f'{row["Teacher"]} \n {teacher_rank} \n ID: {row["Source"]} - Gen {teacher_gen}')
135
+ net.add_node(target, font = {'size': 30, 'color': 'red'}, color = value_to_hex(student_narrations), label = f'{row["Student"]} \n{student_rank} \n ID: {row["Destination"]} - Gen {student_gen}')
136
  net.add_edge(source, target, color = value_to_hex(int(row[f'{yaxis} Count'])), label = f"{row[f'{yaxis} Count']}")
137
  net.barnes_hut(gravity=-5000, central_gravity=0.3, spring_length=200)
138
  html = net.generate_html()