use flodl_hf::models::bert::BertForQuestionAnswering;
fn main() -> flodl::Result<()> {
let qa = BertForQuestionAnswering::from_pretrained(
"csarron/bert-base-uncased-squad-v1",
)?;
let pairs = &[
(
"Where does fab2s live?",
"fab2s lives in Latent and writes Rust deep learning code.",
),
(
"What does flodl wrap?",
"flodl is a Rust deep learning framework built on top of libtorch via an FFI shim.",
),
];
let answers = qa.answer_batch(pairs)?;
for ((q, c), a) in pairs.iter().zip(&answers) {
println!("Q: {q}");
println!("C: {c}");
println!("A: {:?} (tokens [{}..={}], score={:.3})", a.text, a.start, a.end, a.score);
println!();
}
Ok(())
}