dexay commited on
Commit
452d105
·
1 Parent(s): 9769115

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +33 -21
app.py CHANGED
@@ -253,7 +253,7 @@ if submit and len(x) != 0:
253
  for e in edccanbis:
254
  if e[-1]== ["B-EDC","B-CANCER"]:
255
  edccann += [[e[0],e[1],e[2]]]
256
- st.write("am in edcann")
257
 
258
  elif e[-1]== ["B-EDC","B-HORMONE"]:
259
  edchorm += [[e[0],e[1],e[2]]]
@@ -280,7 +280,19 @@ if submit and len(x) != 0:
280
  hormcancsv = hormcandf.to_csv('hormcan.csv')
281
  hormrecepcsv = hormrecepdf.to_csv('hormrecep.csv')
282
 
 
 
 
 
 
 
 
 
 
 
283
  with zipfile.ZipFile("allcsvs.zip", "w") as zipf:
 
 
284
  if len(edccann)!=0:
285
  zipf.write('edccan.csv')
286
 
@@ -292,31 +304,31 @@ if submit and len(x) != 0:
292
  zipf.write('hormcan.csv')
293
  if len(hormrecep)!=0:
294
  zipf.write('hormrecep.csv')
 
 
295
  zipf.close()
296
 
297
- for e in edccanbis:
298
- edccan += [[e[3],e[0]+" ["+e[-1][0][2:]+"]", e[1]+" ["+e[-1][1][2:]+"]",e[2]]]
299
-
300
- edccandf = pd.DataFrame(edccan, columns= ["Sentence", "Entity 1", "Entity 2", "Relation"] )
301
-
302
-
303
  st.table(edccandf)
304
  csv = edccandf.to_csv(index=False).encode('utf-8')
305
- st.download_button(
306
- label="Download all data as CSV",
307
- data=csv,
308
- file_name='Relation_triples.csv',
309
- mime='text/csv',
310
- )
311
-
312
- with open("allcsvs.zip", "rb") as fp:
313
- btn = st.download_button(
314
- label="Download ZIP",
315
- data=fp,
316
- file_name="SeperateCsvs.zip",
317
- mime="application/zip"
318
  )
319
-
 
 
 
 
 
 
 
 
320
 
321
 
322
 
 
253
  for e in edccanbis:
254
  if e[-1]== ["B-EDC","B-CANCER"]:
255
  edccann += [[e[0],e[1],e[2]]]
256
+
257
 
258
  elif e[-1]== ["B-EDC","B-HORMONE"]:
259
  edchorm += [[e[0],e[1],e[2]]]
 
280
  hormcancsv = hormcandf.to_csv('hormcan.csv')
281
  hormrecepcsv = hormrecepdf.to_csv('hormrecep.csv')
282
 
283
+
284
+
285
+ for e in edccanbis:
286
+ edccan += [[e[3],e[0]+" ["+e[-1][0][2:]+"]", e[1]+" ["+e[-1][1][2:]+"]",e[2]]]
287
+
288
+ edccandf = pd.DataFrame(edccan, columns= ["Sentence", "Entity 1", "Entity 2", "Relation"] )
289
+
290
+ edccandf.to_csv("table.csv")
291
+
292
+
293
  with zipfile.ZipFile("allcsvs.zip", "w") as zipf:
294
+ if len(edccan)!=0:
295
+ zipf.write('table.csv')
296
  if len(edccann)!=0:
297
  zipf.write('edccan.csv')
298
 
 
304
  zipf.write('hormcan.csv')
305
  if len(hormrecep)!=0:
306
  zipf.write('hormrecep.csv')
307
+
308
+
309
  zipf.close()
310
 
 
 
 
 
 
 
311
  st.table(edccandf)
312
  csv = edccandf.to_csv(index=False).encode('utf-8')
313
+ st.sidebar:
314
+ st.write("You can only choose one download!!")
315
+ st.write("we recommed ZIP file.")
316
+ st.write("Download table only:")
317
+ st.download_button(
318
+ label="Download CSV",
319
+ data=csv,
320
+ file_name='Relation_triples_table.csv',
321
+ mime='text/csv',
 
 
 
 
322
  )
323
+ st.write("Download table plus separate csvs for each family of pairs:")
324
+ with open("allcsvs.zip", "rb") as fp:
325
+ btn = st.download_button(
326
+ label="Download ZIP",
327
+ data=fp,
328
+ file_name="SeparateCsvs.zip",
329
+ mime="application/zip"
330
+ )
331
+ )
332
 
333
 
334