Flux9665 commited on
Commit
089ec5a
β€’
1 Parent(s): e6e0497

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +18 -5
app.py CHANGED
@@ -93,19 +93,31 @@ class Measurer:
93
 
94
  def get_dists(self, l1, l2):
95
  if l1 in self.tree_dist_func:
96
- tree_dist = self.tree_dist_func[l1][l2]
 
 
 
97
  else:
98
  tree_dist = self.tree_dist_func[l2][l1]
99
  if l1 in self.map_dist_func:
100
- map_dist = self.map_dist_func[l1][l2]
 
 
 
101
  else:
102
  map_dist = self.map_dist_func[l2][l1]
103
  if l1 in self.asp_dist_func:
104
- asp_dist = self.asp_dist_func[l1][l2]
 
 
 
105
  else:
106
  asp_dist = self.asp_dist_func[l2][l1]
107
  if l1 in self.learned_dist_func:
108
- learned_dist = self.learned_dist_func[l1][l2]
 
 
 
109
  else:
110
  learned_dist = self.learned_dist_func[l2][l1]
111
  return tree_dist, map_dist, asp_dist, learned_dist
@@ -142,5 +154,6 @@ iface = gr.Interface(fn=m.measure,
142
  outputs=[gr.Plot(),
143
  gr.Plot(),
144
  gr.Plot(),
145
- gr.Plot()])
 
146
  iface.launch()
 
93
 
94
  def get_dists(self, l1, l2):
95
  if l1 in self.tree_dist_func:
96
+ if l2 in self.tree_dist_func[l1]:
97
+ tree_dist = self.tree_dist_func[l1][l2]
98
+ else:
99
+ tree_dist = self.tree_dist_func[l2][l1]
100
  else:
101
  tree_dist = self.tree_dist_func[l2][l1]
102
  if l1 in self.map_dist_func:
103
+ if l2 in self.map_dist_func[l1]:
104
+ map_dist = self.map_dist_func[l1][l2]
105
+ else:
106
+ map_dist = self.map_dist_func[l2][l1]
107
  else:
108
  map_dist = self.map_dist_func[l2][l1]
109
  if l1 in self.asp_dist_func:
110
+ if l2 in self.asp_dist_func[l1]:
111
+ asp_dist = self.asp_dist_func[l1][l2]
112
+ else:
113
+ asp_dist = self.asp_dist_func[l2][l1]
114
  else:
115
  asp_dist = self.asp_dist_func[l2][l1]
116
  if l1 in self.learned_dist_func:
117
+ if l2 in self.learned_dist_func[l1]:
118
+ learned_dist = self.learned_dist_func[l1][l2]
119
+ else:
120
+ learned_dist = self.learned_dist_func[l2][l1]
121
  else:
122
  learned_dist = self.learned_dist_func[l2][l1]
123
  return tree_dist, map_dist, asp_dist, learned_dist
 
154
  outputs=[gr.Plot(),
155
  gr.Plot(),
156
  gr.Plot(),
157
+ gr.Plot()],
158
+ article="This demo allows you to view the distance between two languages from the ISO 639-3 list according to several distance measurement functions. For more information, check out our paper: https://arxiv.org/abs/2406.06403 and our text-to-speech tool, in which we make use of this technique: https://github.com/DigitalPhonetics/IMS-Toucan")
159
  iface.launch()