Pinokio 2
Highlights:
- Autonomous Scripts
- Zero click launch
- Customizable apps
- Pinokio Public Node
- One click stop
- Gradio file system
- Disposable apps
- More Efficient Disk Space Usage
- Bug fix
- Community Features
Autonomous Scripts
With 2.0, Pinokio Scripts can automatically start WITHOUT the user having to click through menu items. This removes a lot of friction in user experience, as well as enabling a lot of interesting use cases optimized for AI. What does this mean?
- Instead of having to click the menu buttons, you can program scripts so that simply opening an app will run the relevant script.
- For example, if an app is downloaded but hasn't been installed, run the install script.
- Or, if the app is already installed, automatically launch the app by running the start script.
- This behavior can be defined in the
pinokio.js
file by setting thedefault: true
for whichever menu item needs to be selected at any given time. Any menu item that's set asdefault: true
will be automatically selected, and when a script is selected it runs.- Because the
menu
function gets refreshed every time a script finishes a step, this means it is possible to check for certain condition and start a script when relevant. - For example, check if an app install folder already exists, and if it exists, run the start script to launch the app. But if the app folder does not exist, run the install script instead.
- Because the
Example:
module.exports = {
"version": "2.0",
"title": "Autostart",
"menu": async (kernel, info) => {
let installed = info.exists("app/env")
if (installed) {
// already installed, automatically run "start.json"
return [{
default: true,
text: "start",
href: "start.json",
}, {
text: "install",
href: "install.json"
}]
} else {
// not installed. run "install.json"
return [{
text: "start",
href: "start.json",
}, {
default: true,
text: "install",
href: "install.json"
}]
}
}]
}
Zero Click Launch
1 Click Launchers aren't cool. You know what's cool? 0 Click launchers.
Before 2.0
Previously, using apps in Pinokio meant:
- Open Pinokio
- Find the app you want to use
- Click the app to visit the app page
- Click the "start" button to start the app
- After the app starts, click "web UI" to open the web app
See, this is not really a "1 click" experience, is it?
After 2.0, with Zero Click Launch
You can now use Pinokio apps with the following step:
- Start typing a pinokio app name in your web browser address bar.
- It will autocomplete the URL (assuming you've visited it before)
- Just open the web page, and you're good to go.
No clicks, not even a need to open the Pinokio app. You can basically use the local Pinokio apps just like visiting online websites.
Here's how it works:
- Instant Access: You should be able to open any app INSTANTLY simply by typing its name in a browser address bar.
- Simply start typing the app's name in any browser address bar, and it will autocomplete (if you have visited the app before).
- Instant Launch: You shouldn't have to manually "launch" an app first just to use the app. Think about regular online websites, you simply visit a URL and the website is there. This should be the standard. No need to explicitly launch an app just to use.
- When an app is not already running, it will automatically launch when you visit it, and then present you the UI. All automatically. No clicks needed.
- If the app is already running, then it's instant access. It's almost like using a regular website.
1. Launch and Run
For example, here's what happens if you visit a Pinokio app that is NOT running yet:
Since the app is not running,
- it first launches the app
- and then automatically redirects to the Web UI.
There was NO clicks involved. The redirects were automatic.
2. Instant Run
And what if the app is ALREADY running? Then it works no different from visiting a regular online website. Here's an example where I start typing "stable diffusion web ui", and the browser autocompletes the URL and I visit the page, and it sends me directly the web app.
Customizable apps
Pinokio is a tool for the tinkerers and hobbyists. It should make it dead simple for people to customize WITHOUT having to touch the code.
However this has not been easy. Until now, Pinokio didn't provide an easy way for end users to tinker with custom settings. For example if you want to change where files are stored, you had to edit the pinokio script code.
Pinokio 2.0 introduces ENVIRONMENT variables. Scripts can make use of environment variables instead of having to hardcode everything. Each app can have a custom environment variable file.
1. Template
You can define environment variables by simply updating a file named ENVIRONMENT
(which is automatically created when you first install any script). Here's an example ENVIRONMENT
file:
CHECKPOINT_PATH=./models/llama3.gguf
Pinokio scripts may use the variable simply by accessing the env
variable:
{
"run": [{
"method": "shell.run",
"params": {
"message": "./llama-server -m {{env.CHECKPOINT_PATH}}",
"path": "llamacpp"
}
}]
}
2. Sandboxed Environment Variables
Normally, setting environment variables require people to change it globally. This is not flexible since every app may have different requirements and you probably want a custom environment for each app.
Thanks to Pinokio's isolated architecture, every value set in each app's ENVIRONMENT
file is constrained only to the app.
3. Friendly Interface
The built-in editor lets you tweak environment variables without touching the files directly. You can access the ENVIRONMENT
editor interface inside the Configure
tab in every app.
4. Custom Installer
Every app has a custom install page where the user can tweak the default settings BEFORE installing anything, such as changing the file folders, share settings, etc.
Pinokio Public Node
Now you can open up local Pinokio apps to the public internet.
1. Turn your local computer into a public web service
Anyone with a browser can connect to your local machine and run the apps you publish as public, powered by Cloudflare tunnel.
- Run an AI inference service from your local computer, which anyone can access.
- Keep your pinokio running at home and connect to it from outside using any device (such as phones)
2. Add authentication
Often you will want to only expose your public node to a select group of people. To achieve this, you can add authentication, which will require any user trying to connect to enter a correct passcode.
Turning on authentication is as easy as setting a "passcode" from the share settings page.
When you add authentication, you will be able to monitor all the incoming connections, from their IP to the device & browser information as well as which passcode is being used to make the connection.
Instantly Stop Scripts
When running things locally, stopping an app is as important as starting one, because most personal computers have limited resources and you can't be running all apps at once, and have to optimize your resources.
Before: Stopping an app wasn't easy. You had to visit the app page, open the app terminal, and click stop once the terminal loaded. Too many clicks.
After: you can stop any app with one click, either from home, or from the tabs.
Gradio File System
- Application File System: all files uploaded through gradio are now stored under the app folder (inside a folder named 'cache') instead of getting stored in an unknown location. Now you can view and manage all your files generated from gradio apps.
- Customizable: You can also switch the mode so all the gradio related files across multiple apps are stored deduplicated in one location, by setting the GRADIO_TEMP_DIR environment variable.
- Cross-app file sharing: Gradio has a security policy that blocks apps from serving files that are outside of each app's folder. For example, all the image files generated by automatic1111 stable diffusion web ui cannot be served by another app (for example a 3rd party app that serves the image files). This is for security reasons. With Pinokio, since everything happens inside pinokio anyway, Pinokio can expand this policy a bit and allow any app within the Pinokio operating system to be shared with any other app.
Disposable Apps
- Disposable Mode Install: Previously, if you install an app that uses torch hub files or any file from huggingface (for example through diffusers, transformers, etc.), all these files were stored in a single central location in order to save disk space. While this is ideal in many cases, a lot of times you just want to try an app and when you're done, just delete it, and want all the associated files to be deleted together. This was not possible before, but with 2.0, this is the default option when installing apps. Now every app install is self-contained by default, so when you delete the app folder, all the huge files associated with it will be gone with the app.
- Disk Space Save Mode Install: By default, all apps install in a disposable mode. But you can even customize this behavior and let Pinokio store these files globally in a deduplicated manner. This will be useful when you try out an app and decide to keep it. If you think you may want to keep using the app, you may want to reinstall with the deduplication logic on (You can achieve this by deleting the HF_HOME and TORCH_HOME environment variables from the app folder)
Virtual drive optimization
The previous virtual drive implementation had some issues dealing with edge cases with PIP. This meant many apps could not take advantage of the disk space saving feature provided by the virtual drive.
With 2.0, this has been fixed and now all apps can take advantage of the virtual drive feature, saving your disk space significantly more.
Conda fix
Since the very beginning of Pinokio, we've had several bugs where things wouldn't exactly run in a self-contained manner if you already had Conda installed on your system outside of pinokio. Until now, all the fixes have been adhoc approaches, but with 2.0, it's been fixed on a fundamental level. If you ever had issues with conda, delete the "bin" folder and try reinstalling from scratch. (new users won't have this problem)
Community
1. Community Docs
Community members are welcome to share whatever related to Pinokio. Just create a github repository and add a "pinokio-community" topic, and it will show up on the Community Docs section.
If you have any tips or insights using Pinokio, you are welcome to contribute.
2. Community Scripts
In addition to the verified scripts, now there's a dedicated tab for "Community scripts". To list your script here, simply add a "pinokio" topic to your github repo and it will show up here automatically.
Note that it is still not considered safe to blindly install these scripts. Only the scripts on the verified list is safe to install since they have all been verified to have no malicious code and frozen.
Going forward, I am planning to try a new experiment where some apps from this section are eventually promoted to the "Verified scripts" via Pinokio factory. Will explain this further in another post.