mirror of
https://github.com/huggingface/candle.git
synced 2025-06-21 20:22:49 +00:00
[Wasm] BLIP Example (#1183)
* blip wasm start * fix dependency issue, move token stream here * vanilla js worker * roll back vscode * spell
This commit is contained in:
17
candle-wasm-examples/blip/src/lib.rs
Normal file
17
candle-wasm-examples/blip/src/lib.rs
Normal file
@ -0,0 +1,17 @@
|
||||
use wasm_bindgen::prelude::*;
|
||||
pub mod token_output_stream;
|
||||
|
||||
#[wasm_bindgen]
|
||||
extern "C" {
|
||||
// Use `js_namespace` here to bind `console.log(..)` instead of just
|
||||
// `log(..)`
|
||||
#[wasm_bindgen(js_namespace = console)]
|
||||
pub fn log(s: &str);
|
||||
}
|
||||
|
||||
#[macro_export]
|
||||
macro_rules! console_log {
|
||||
// Note that this is using the `log` function imported above during
|
||||
// `bare_bones`
|
||||
($($t:tt)*) => ($crate::log(&format_args!($($t)*).to_string()))
|
||||
}
|
Reference in New Issue
Block a user