hugging2021 commited on
Commit
a623e87
·
verified ·
1 Parent(s): 6ca1a49

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -2
app.py CHANGED
@@ -13,13 +13,15 @@ io1 = gr.load("huggingface/bert-base-cased")
13
  io2 = gr.load("huggingface/bert-base-uncased")
14
 
15
  def inference(inputtext, model):
 
 
 
16
  if model == "bert-base-cased":
17
  outlabel = io1(inputtext)
18
  elif model == "bert-base-uncased":
19
  outlabel = io2(inputtext)
20
  else:
21
  outlabel = "Invalid model selected"
22
- # Sicherstellen, dass die Ausgabe eine formatierte Zeichenkette ist
23
  return str(outlabel)
24
 
25
  # Aktualisierte Gradio-Syntax
@@ -34,4 +36,4 @@ gr.Interface(
34
  article=article,
35
  title=title,
36
  description=description
37
- ).launch()
 
13
  io2 = gr.load("huggingface/bert-base-uncased")
14
 
15
  def inference(inputtext, model):
16
+ if "[MASK]" not in inputtext:
17
+ return "Error: The input text must contain the [MASK] token."
18
+
19
  if model == "bert-base-cased":
20
  outlabel = io1(inputtext)
21
  elif model == "bert-base-uncased":
22
  outlabel = io2(inputtext)
23
  else:
24
  outlabel = "Invalid model selected"
 
25
  return str(outlabel)
26
 
27
  # Aktualisierte Gradio-Syntax
 
36
  article=article,
37
  title=title,
38
  description=description
39
+ ).launch(share=True)