Update app.py
Browse files
app.py
CHANGED
@@ -113,9 +113,9 @@ def watset(G: nx.Graph, algorithm: str, seed: int = 0,
|
|
113 |
capture_output=True, text=True, timeout=timeout)
|
114 |
|
115 |
if result.returncode != 0:
|
116 |
-
raise gr.Error(f'
|
117 |
except subprocess.SubprocessError as e:
|
118 |
-
raise gr.Error(f'
|
119 |
|
120 |
df_clusters = pd.read_csv(clusters, sep='\t', names=('cluster', 'size', 'items'),
|
121 |
dtype={'cluster': int, 'size': int, 'items': str})
|
@@ -130,9 +130,9 @@ def watset(G: nx.Graph, algorithm: str, seed: int = 0,
|
|
130 |
capture_output=True, text=True, timeout=timeout)
|
131 |
|
132 |
if result.returncode != 0:
|
133 |
-
raise gr.Error(f'
|
134 |
except subprocess.SubprocessError as e:
|
135 |
-
raise gr.Error(f'
|
136 |
|
137 |
G_senses = nx.read_edgelist(senses.name, delimiter='\t', comments='\n', data=[('weight', float)])
|
138 |
|
@@ -150,7 +150,7 @@ def handler(file: IO[bytes], algorithm: str, seed: int) -> Tuple[pd.DataFrame, p
|
|
150 |
|
151 |
with open(file.name) as f:
|
152 |
try:
|
153 |
-
dialect = csv.Sniffer().sniff(f.
|
154 |
delimiter = dialect.delimiter
|
155 |
except csv.Error:
|
156 |
delimiter = ','
|
|
|
113 |
capture_output=True, text=True, timeout=timeout)
|
114 |
|
115 |
if result.returncode != 0:
|
116 |
+
raise gr.Error(f'Clustering error (code {result.returncode}): {result.stderr}')
|
117 |
except subprocess.SubprocessError as e:
|
118 |
+
raise gr.Error(f'Clustering error: {e}')
|
119 |
|
120 |
df_clusters = pd.read_csv(clusters, sep='\t', names=('cluster', 'size', 'items'),
|
121 |
dtype={'cluster': int, 'size': int, 'items': str})
|
|
|
130 |
capture_output=True, text=True, timeout=timeout)
|
131 |
|
132 |
if result.returncode != 0:
|
133 |
+
raise gr.Error(f'Graph error (code {result.returncode}): {result.stderr}')
|
134 |
except subprocess.SubprocessError as e:
|
135 |
+
raise gr.Error(f'Graph error: {e}')
|
136 |
|
137 |
G_senses = nx.read_edgelist(senses.name, delimiter='\t', comments='\n', data=[('weight', float)])
|
138 |
|
|
|
150 |
|
151 |
with open(file.name) as f:
|
152 |
try:
|
153 |
+
dialect = csv.Sniffer().sniff(f.read(4096))
|
154 |
delimiter = dialect.delimiter
|
155 |
except csv.Error:
|
156 |
delimiter = ','
|