Skip to content

Reader instead of File #4

@Houski

Description

@Houski

Would it be possible (and a good idea?) to change the required File type to Reader here?

pub fn new_from_pre_trained(file: &mut File) -> Result<Self, io::Error> {

So something like this can be performed:

let faux_model_file = include_str!("./perform_contact_spam_filter_model.json");
 
 let classifier = Classifier::new_from_pre_trained(&mut std::io::Cursor::new(faux_model_file)).expect("Failed to load spam filter model");

Without the need to touch the file system?

It seems like it should take something more like a &str, and then the user is responsible for however that &str gets to the function.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions