aminghias commited on
Commit
6c59693
1 Parent(s): a3a678d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -19
app.py CHANGED
@@ -4,11 +4,7 @@ import pandas as pd
4
 
5
  from transformers import pipeline
6
 
7
- # model_name="aminghias/distilbert-base-uncased-finetuned-imdb"
8
 
9
- # mask_filler = pipeline(
10
- # "fill-mask", model=model_name
11
- # )
12
 
13
  pipe = pipeline("fill-mask", model="aminghias/Clinical-BERT-finetuned")
14
  pipe2 = pipeline("fill-mask", model="emilyalsentzer/Bio_ClinicalBERT")
@@ -16,8 +12,6 @@ pipe3= pipeline("fill-mask", model="medicalai/ClinicalBERT")
16
 
17
 
18
 
19
-
20
-
21
  def predict(text):
22
 
23
  pred1 = pipe(text)
@@ -48,36 +42,27 @@ def predict(text):
48
 
49
  df_join=df_join.sort_values(by='score_average',ascending=False)
50
  df_join=df_join.reset_index(drop=True)
51
- # df_join=df_join.dropna()
52
- # df_join=df_join.fillna(0)
53
  df=df_join.copy()
54
  df_join=df_join[['token_str','score_average','score_finetuned_CBERT','score_Bio_CBERT','score_CBERT']].head()
55
 
56
- # gr.Interface(fn=lambda: df_join, inputs=None, outputs=gr.Dataframe(headers=df_join.columns)).launch()
57
-
58
- # print(df_join)
59
- # df_join['sum_sequence'][0]
60
  return (df['sum_sequence'][0],df_join)
61
 
62
-
63
- # return (pipe(text)[0]['sequence'],pipe2(text)[0]['sequence'])
64
 
65
  demo = gr.Interface(
66
  fn=predict,
67
  inputs='text',
68
  # outputs='text',
69
  outputs=['text', gr.Dataframe()],
70
- # outputs='text','text',
71
-
72
- # outputs=gr.Dataframe(headers=['title', 'author', 'text']), allow_flagging='never')
73
 
74
  title="Filling Missing Clinical/Medical Data ",
75
  examples=[ ['The high blood pressure was due to [MASK] which is critical.'],
76
  ['The patient is suffering from throat infection causing [MASK] and cough.']
77
  ],
78
  description="This application fills any missing words in the medical domain",
79
- # fn=lambda: df, inputs=None, outputs=gr.Dataframe(headers=df_join.columns)
80
- # fn = infer, inputs = inputs, outputs = outputs, examples = [[df_join.head()]]
81
  )
82
 
83
  demo.launch()
 
4
 
5
  from transformers import pipeline
6
 
 
7
 
 
 
 
8
 
9
  pipe = pipeline("fill-mask", model="aminghias/Clinical-BERT-finetuned")
10
  pipe2 = pipeline("fill-mask", model="emilyalsentzer/Bio_ClinicalBERT")
 
12
 
13
 
14
 
 
 
15
  def predict(text):
16
 
17
  pred1 = pipe(text)
 
42
 
43
  df_join=df_join.sort_values(by='score_average',ascending=False)
44
  df_join=df_join.reset_index(drop=True)
45
+
 
46
  df=df_join.copy()
47
  df_join=df_join[['token_str','score_average','score_finetuned_CBERT','score_Bio_CBERT','score_CBERT']].head()
48
 
49
+
 
 
 
50
  return (df['sum_sequence'][0],df_join)
51
 
52
+
 
53
 
54
  demo = gr.Interface(
55
  fn=predict,
56
  inputs='text',
57
  # outputs='text',
58
  outputs=['text', gr.Dataframe()],
 
 
 
59
 
60
  title="Filling Missing Clinical/Medical Data ",
61
  examples=[ ['The high blood pressure was due to [MASK] which is critical.'],
62
  ['The patient is suffering from throat infection causing [MASK] and cough.']
63
  ],
64
  description="This application fills any missing words in the medical domain",
65
+
 
66
  )
67
 
68
  demo.launch()