mirror of
https://github.com/pinokiofactory/flux-webui.git
synced 2024-10-05 23:57:57 +03:00
init
This commit is contained in:
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
node_modules
|
||||
.DS_Store
|
||||
15
app.py
Normal file
15
app.py
Normal file
@@ -0,0 +1,15 @@
|
||||
import gradio as gr
|
||||
import torch
|
||||
from diffusers import DiffusionPipeline
|
||||
import devicetorch
|
||||
device = devicetorch.get(torch)
|
||||
pipe = DiffusionPipeline.from_pretrained("stabilityai/sdxl-turbo").to(device)
|
||||
def generate_image(prompt):
|
||||
return pipe(
|
||||
prompt,
|
||||
num_inference_steps=2,
|
||||
strength=0.5,
|
||||
guidance_scale=0.0
|
||||
).images[0]
|
||||
app = gr.Interface(fn=generate_image, inputs="text", outputs="image")
|
||||
app.launch()
|
||||
32
install.js
Normal file
32
install.js
Normal file
@@ -0,0 +1,32 @@
|
||||
module.exports = {
|
||||
run: [
|
||||
// Delete this step if your project does not use torch
|
||||
{
|
||||
method: "script.start",
|
||||
params: {
|
||||
uri: "torch.js",
|
||||
params: {
|
||||
venv: "env", // Edit this to customize the venv folder path
|
||||
// xformers: true // uncomment this line if your project requires xformers
|
||||
}
|
||||
}
|
||||
},
|
||||
// Edit this step with your custom install commands
|
||||
{
|
||||
method: "shell.run",
|
||||
params: {
|
||||
venv: "env", // Edit this to customize the venv folder path
|
||||
message: [
|
||||
"pip install -r requirements.txt"
|
||||
],
|
||||
}
|
||||
},
|
||||
{
|
||||
method: "fs.link",
|
||||
params: {
|
||||
venv: "env"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
87
pinokio.js
Normal file
87
pinokio.js
Normal file
@@ -0,0 +1,87 @@
|
||||
const path = require('path')
|
||||
module.exports = {
|
||||
version: "2.0",
|
||||
title: "flux-all",
|
||||
description: "",
|
||||
icon: "icon.webp",
|
||||
menu: async (kernel, info) => {
|
||||
let installed = info.exists("env")
|
||||
let running = {
|
||||
install: info.running("install.js"),
|
||||
start: info.running("start.js"),
|
||||
update: info.running("update.js"),
|
||||
reset: info.running("reset.js")
|
||||
}
|
||||
if (running.install) {
|
||||
return [{
|
||||
default: true,
|
||||
icon: "fa-solid fa-plug",
|
||||
text: "Installing",
|
||||
href: "install.js",
|
||||
}]
|
||||
} else if (installed) {
|
||||
if (running.start) {
|
||||
let local = info.local("start.js")
|
||||
if (local && local.url) {
|
||||
return [{
|
||||
default: true,
|
||||
icon: "fa-solid fa-rocket",
|
||||
text: "Open Web UI",
|
||||
href: local.url,
|
||||
}, {
|
||||
icon: 'fa-solid fa-terminal',
|
||||
text: "Terminal",
|
||||
href: "start.js",
|
||||
}]
|
||||
} else {
|
||||
return [{
|
||||
default: true,
|
||||
icon: 'fa-solid fa-terminal',
|
||||
text: "Terminal",
|
||||
href: "start.js",
|
||||
}]
|
||||
}
|
||||
} else if (running.update) {
|
||||
return [{
|
||||
default: true,
|
||||
icon: 'fa-solid fa-terminal',
|
||||
text: "Updating",
|
||||
href: "update.js",
|
||||
}]
|
||||
} else if (running.reset) {
|
||||
return [{
|
||||
default: true,
|
||||
icon: 'fa-solid fa-terminal',
|
||||
text: "Resetting",
|
||||
href: "reset.js",
|
||||
}]
|
||||
} else {
|
||||
return [{
|
||||
default: true,
|
||||
icon: "fa-solid fa-power-off",
|
||||
text: "Start",
|
||||
href: "start.js",
|
||||
}, {
|
||||
icon: "fa-solid fa-plug",
|
||||
text: "Update",
|
||||
href: "update.js",
|
||||
}, {
|
||||
icon: "fa-solid fa-plug",
|
||||
text: "Install",
|
||||
href: "install.js",
|
||||
}, {
|
||||
icon: "fa-regular fa-circle-xmark",
|
||||
text: "Reset",
|
||||
href: "reset.js",
|
||||
}]
|
||||
}
|
||||
} else {
|
||||
return [{
|
||||
default: true,
|
||||
icon: "fa-solid fa-plug",
|
||||
text: "Install",
|
||||
href: "install.js",
|
||||
}]
|
||||
}
|
||||
}
|
||||
}
|
||||
5
requirements.txt
Normal file
5
requirements.txt
Normal file
@@ -0,0 +1,5 @@
|
||||
transformers
|
||||
accelerate
|
||||
diffusers
|
||||
gradio
|
||||
devicetorch
|
||||
8
reset.js
Normal file
8
reset.js
Normal file
@@ -0,0 +1,8 @@
|
||||
module.exports = {
|
||||
run: [{
|
||||
method: "fs.rm",
|
||||
params: {
|
||||
path: "env"
|
||||
}
|
||||
}]
|
||||
}
|
||||
36
start.js
Normal file
36
start.js
Normal file
@@ -0,0 +1,36 @@
|
||||
module.exports = {
|
||||
daemon: true,
|
||||
run: [
|
||||
// Edit this step to customize your app's launch command
|
||||
{
|
||||
method: "shell.run",
|
||||
params: {
|
||||
venv: "env", // Edit this to customize the venv folder path
|
||||
env: { }, // Edit this to customize environment variables (see documentation)
|
||||
message: [
|
||||
"python app.py", // Edit with your custom commands
|
||||
],
|
||||
on: [{
|
||||
// The regular expression pattern to monitor.
|
||||
// When this pattern occurs in the shell terminal, the shell will return,
|
||||
// and the script will go onto the next step.
|
||||
"event": "/http:\/\/\\S+/",
|
||||
|
||||
// "done": true will move to the next step while keeping the shell alive.
|
||||
// "kill": true will move to the next step after killing the shell.
|
||||
"done": true
|
||||
}]
|
||||
}
|
||||
},
|
||||
// This step sets the local variable 'url'.
|
||||
// This local variable will be used in pinokio.js to display the "Open WebUI" tab when the value is set.
|
||||
{
|
||||
method: "local.set",
|
||||
params: {
|
||||
// the input.event is the regular expression match object from the previous step
|
||||
url: "{{input.event[0]}}"
|
||||
}
|
||||
},
|
||||
]
|
||||
}
|
||||
|
||||
74
torch.js
Normal file
74
torch.js
Normal file
@@ -0,0 +1,74 @@
|
||||
module.exports = {
|
||||
run: [
|
||||
// windows nvidia
|
||||
{
|
||||
"when": "{{platform === 'win32' && gpu === 'nvidia'}}",
|
||||
"method": "shell.run",
|
||||
"params": {
|
||||
"venv": "{{args && args.venv ? args.venv : null}}",
|
||||
"path": "{{args && args.path ? args.path : '.'}}",
|
||||
"message": "pip install torch==2.3.1 torchvision==0.18.1 torchaudio==2.3.1 {{args && args.xformers ? 'xformers' : ''}} --index-url https://download.pytorch.org/whl/cu121"
|
||||
}
|
||||
},
|
||||
// windows amd
|
||||
{
|
||||
"when": "{{platform === 'win32' && gpu === 'amd'}}",
|
||||
"method": "shell.run",
|
||||
"params": {
|
||||
"venv": "{{args && args.venv ? args.venv : null}}",
|
||||
"path": "{{args && args.path ? args.path : '.'}}",
|
||||
"message": "pip install torch-directml torchvision torchaudio"
|
||||
}
|
||||
},
|
||||
// windows cpu
|
||||
{
|
||||
"when": "{{platform === 'win32' && (gpu !== 'nvidia' && gpu !== 'amd')}}",
|
||||
"method": "shell.run",
|
||||
"params": {
|
||||
"venv": "{{args && args.venv ? args.venv : null}}",
|
||||
"path": "{{args && args.path ? args.path : '.'}}",
|
||||
"message": "pip install torch==2.3.1 torchvision==0.18.1 torchaudio==2.3.1"
|
||||
}
|
||||
},
|
||||
// mac
|
||||
{
|
||||
"when": "{{platform === 'darwin'}}",
|
||||
"method": "shell.run",
|
||||
"params": {
|
||||
"venv": "{{args && args.venv ? args.venv : null}}",
|
||||
"path": "{{args && args.path ? args.path : '.'}}",
|
||||
"message": "pip install torch==2.3.1 torchvision==0.18.1 torchaudio==2.3.1"
|
||||
}
|
||||
},
|
||||
// linux nvidia
|
||||
{
|
||||
"when": "{{platform === 'linux' && gpu === 'nvidia'}}",
|
||||
"method": "shell.run",
|
||||
"params": {
|
||||
"venv": "{{args && args.venv ? args.venv : null}}",
|
||||
"path": "{{args && args.path ? args.path : '.'}}",
|
||||
"message": "pip install torch==2.3.1 torchvision==0.18.1 torchaudio==2.3.1 {{args && args.xformers ? 'xformers' : ''}} --index-url https://download.pytorch.org/whl/cu121"
|
||||
}
|
||||
},
|
||||
// linux rocm (amd)
|
||||
{
|
||||
"when": "{{platform === 'linux' && gpu === 'amd'}}",
|
||||
"method": "shell.run",
|
||||
"params": {
|
||||
"venv": "{{args && args.venv ? args.venv : null}}",
|
||||
"path": "{{args && args.path ? args.path : '.'}}",
|
||||
"message": "pip install torch==2.3.1 torchvision==0.18.1 torchaudio==2.3.1 --index-url https://download.pytorch.org/whl/rocm6.0"
|
||||
}
|
||||
},
|
||||
// linux cpu
|
||||
{
|
||||
"when": "{{platform === 'linux' && (gpu !== 'amd' && gpu !=='nvidia')}}",
|
||||
"method": "shell.run",
|
||||
"params": {
|
||||
"venv": "{{args && args.venv ? args.venv : null}}",
|
||||
"path": "{{args && args.path ? args.path : '.'}}",
|
||||
"message": "pip install torch==2.3.1 torchvision==0.18.1 torchaudio==2.3.1 --index-url https://download.pytorch.org/whl/cpu"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user