# `TFLiteElixir.MobileBert`
[🔗](https://github.com/cocoa-xu/tflite_elixir/blob/main/lib/tflite_elixir/high-level-api/mobile_bert.ex#L1)

# `init`

```elixir
@spec init(String.t()) ::
  {:ok,
   %TFLiteElixir.MobileBert{
     interpreter: term(),
     tensors: term(),
     vocab_map: term()
   }}
```

Load a MobileBERT question-answering model from `model_file`.

The vocabulary comes from the model's own `vocab.txt`, so a model without one
is refused by name rather than failing somewhere inside the tokenizer.

    {:ok, bert} = TFLiteElixir.MobileBert.init("mobilebert.tflite")
    answers = TFLiteElixir.MobileBert.run(bert, query, content)

# `run`

```elixir
@spec run(
  %TFLiteElixir.MobileBert{
    interpreter: term(),
    tensors: term(),
    vocab_map: term()
  },
  String.t(),
  String.t()
) :: [{float(), String.t()}]
```

Answer `query` from `content`.

Returns up to five `{score, excerpt}` tuples, best first, where each excerpt is
a span of `content` and the scores are a softmax over the spans considered.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
