JacobLinCool / gradio-rs

Gradio Client in Rust.
https://crates.io/crates/gradio
MIT License
22 stars 2 forks source link

Synchronous support #2

Closed denizsincar29 closed 2 months ago

denizsincar29 commented 2 months ago

Hello. Is there a way to use gradio client synchronously? My whole app is synchronous so I don't want to rewrite it. Thank you.

JacobLinCool commented 2 months ago

I could try adding a synchronous API.

Before the asynchronous API is done, you can try using block_on to run an asynchronous function in a synchronous context, I think.

JacobLinCool commented 2 months ago

Hi @denizsincar29,

The synchronization API is now available in 0.2.3, try using the *_sync functions. You can check out the "hello-sync" example to see usage.

denizsincar29 commented 2 months ago

Oh thank you so much. That's cool. Just wanted to ask if it also supports wasm?

JacobLinCool commented 2 months ago

I think it's possible, but I may need to figure out the right feature flags for Tokio and Reqwest.

If you're interested in that, here are some references you may need:

However, Gradio already has an official JS client, so you may want to try it in your WASM environment if it also supports JS.

Move WASM support to a new issue: https://github.com/JacobLinCool/gradio-rs/issues/3