view article Article In-browser LLM app in pure Python: Gemini Nano + Gradio-Lite By whitphx • Jul 12 • 10
view post Post 2319 Have you looked at the Gemini Nano local LLM?Gradio-Lite, the in-browser ver. of Gradio, gives it a rich interface using only Python code, even for such an in-browser AI app!Try out a chat app that runs completely inside your browser 👇https://www.gradio.app/playground?demo=Hello_World&code=IyBOT1RFOiBHZW1pbmkgTmFubyBtdXN0IGJlIGVuYWJsZWQgaW4geW91ciBicm93c2VyLiBTZWUgYXJ0aWNsZXMgbGlrZSBodHRwczovL3dyaXRpbmdtYXRlLmFpL2Jsb2cvYWNjZXNzLXRvLWdlbWluaS1uYW5vLWxvY2FsbHkKaW1wb3J0IGdyYWRpbyBhcyBncgpmcm9tIGpzIGltcG9ydCBzZWxmICAjIFB5b2RpZGUgcHJvdmlkZXMgYWNjZXNzIHRvIHRoZSBKUyBzY29wZSB2aWEgYGpzYCBtb2R1bGUuIFNlZSBodHRwczovL3B5b2RpZGUub3JnL2VuL3N0YWJsZS91c2FnZS9hcGkvcHl0aG9uLWFwaS5odG1sI3B5dGhvbi1hcGkKCiMgSW5pdGlhbGl6ZSBQcm9tcHQgQVBJCnNlc3Npb24gPSBOb25lCnRyeToKICAgIGNhbl9haV9jcmVhdGUgPSBhd2FpdCBzZWxmLmFpLmNhbkNyZWF0ZVRleHRTZXNzaW9uKCkKICAgIGlmIGNhbl9haV9jcmVhdGUgIT0gIm5vIjoKICAgICAgICBzZXNzaW9uID0gYXdhaXQgc2VsZi5haS5jcmVhdGVUZXh0U2Vzc2lvbigpCmV4Y2VwdDoKICAgIHBhc3MKCgpzZWxmLmFpX3RleHRfc2Vzc2lvbiA9IHNlc3Npb24KCgphc3luYyBkZWYgcHJvbXB0KG1lc3NhZ2UsIGhpc3RvcnkpOgogICAgc2Vzc2lvbiA9IHNlbGYuYWlfdGV4dF9zZXNzaW9uCiAgICBpZiBub3Qgc2Vzc2lvbjoKICAgICAgICByYWlzZSBFeGNlcHRpb24oIkdlbWluaSBOYW5vIGlzIG5vdCBhdmFpbGFibGUgaW4geW91ciBicm93c2VyLiIpCgogICAgc3RyZWFtID0gc2Vzc2lvbi5wcm9tcHRTdHJlYW1pbmcobWVzc2FnZSkKICAgIGFzeW5jIGZvciBjaHVuayBpbiBzdHJlYW06CiAgICAgICAgeWllbGQgY2h1bmsKCgpkZW1vID0gZ3IuQ2hhdEludGVyZmFjZShmbj1wcm9tcHQpCgpkZW1vLmxhdW5jaCgpNote: Gemini Nano is currently only available on Chrome Canary, and you need to opt-in.Follow the "Installation" section in https://huggingface.co/blog/Xenova/run-gemini-nano-in-your-browser . 🔥 3 3 👍 1 1 + Reply