JacobLinCool / gradio-rs

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

View gradio api and macro #6

Open denizsincar29 opened 2 months ago

denizsincar29 commented 2 months ago

I have a great idea and a question: How to quickly prety print or save to txt the gradio space api? Manually iterate over endpoints and arguments? Idea: What if we make a macro that generates code and functions to use with some api? e.g. let Client = client::new_sync(params); let endpoint = client.generate_endpoint!(); endpoint.transcribe(text, param1, param2);

JacobLinCool commented 2 months ago

Both AppConfig and ApiInfo (which can be obtained using .view_config() and .view_api()) can be serialized by serde. But this is far from "pretty" printing, and I don't know if that's what you want.

I think your macro is good for DX and type checking. I haven't looked into Rust macros before, but I thought if there were some similar examples like converting openapi to client, I might be able to figure this out. Do you have experience doing this?

denizsincar29 commented 2 months ago

@JacobLinCool I will try making a simple macro for this and show you, but is it possible to move to private messaging for example in telegram?