pulkitmehtawork commited on
Commit
4043604
·
1 Parent(s): f165449

Fill mask modern bert

Browse files
Files changed (1) hide show
  1. app.py +6 -5
app.py CHANGED
@@ -10,19 +10,20 @@ pipe = pipeline(
10
  torch_dtype=torch.bfloat16,
11
  )
12
 
 
13
  # Function to run the model
14
  def fill_mask(input_text):
15
- return pipe(input_text)
 
16
 
17
  # Set up the Gradio interface
18
  iface = gr.Interface(
19
- fn=fill_mask,
20
- inputs="text",
21
  outputs="json",
22
  title="Mask Filling with ModernBERT",
23
- description="Enter a sentence with a [MASK] token, and the model will predict the missing word."
24
  )
25
 
26
  # Launch the interface
27
  iface.launch()
28
-
 
10
  torch_dtype=torch.bfloat16,
11
  )
12
 
13
+
14
  # Function to run the model
15
  def fill_mask(input_text):
16
+ return pipe(input_text)[0]["0"]["sequence"]
17
+
18
 
19
  # Set up the Gradio interface
20
  iface = gr.Interface(
21
+ fn=fill_mask,
22
+ inputs="text",
23
  outputs="json",
24
  title="Mask Filling with ModernBERT",
25
+ description="Enter a sentence with a [MASK] token, and the model will predict the missing word.",
26
  )
27
 
28
  # Launch the interface
29
  iface.launch()