mirror of
https://github.com/storytold/artcraft.git
synced 2026-11-21 00:55:08 +00:00
don't write files to fs
This commit is contained in:
1 parent
db41d488f8
commit
92f25f884f
4 files changed
+54
-64
No files matched your search
Generated
+44
-43
@@ -12,7 +12,7 @@ dependencies = [
|
||||
"actix-rt",
|
||||
"actix_derive",
|
||||
"bitflags 2.5.0",
|
||||
"bytes 1.6.0",
|
||||
"bytes 1.10.0",
|
||||
"crossbeam-channel",
|
||||
"futures-core",
|
||||
"futures-sink",
|
||||
@@ -34,7 +34,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5f7b0a21988c1bf877cf4759ef5ddaac04c1c9fe808c9142ecb78ba97d97a28a"
|
||||
dependencies = [
|
||||
"bitflags 2.5.0",
|
||||
"bytes 1.6.0",
|
||||
"bytes 1.10.0",
|
||||
"futures-core",
|
||||
"futures-sink",
|
||||
"memchr",
|
||||
@@ -73,7 +73,7 @@ dependencies = [
|
||||
"base64 0.22.1",
|
||||
"bitflags 2.5.0",
|
||||
"brotli 6.0.0",
|
||||
"bytes 1.6.0",
|
||||
"bytes 1.10.0",
|
||||
"bytestring",
|
||||
"derive_more",
|
||||
"encoding_rs",
|
||||
@@ -117,7 +117,7 @@ dependencies = [
|
||||
"actix-multipart-derive",
|
||||
"actix-utils",
|
||||
"actix-web",
|
||||
"bytes 1.6.0",
|
||||
"bytes 1.10.0",
|
||||
"derive_more",
|
||||
"futures-core",
|
||||
"futures-util",
|
||||
@@ -227,7 +227,7 @@ dependencies = [
|
||||
"actix-utils",
|
||||
"actix-web-codegen",
|
||||
"ahash 0.8.11",
|
||||
"bytes 1.6.0",
|
||||
"bytes 1.10.0",
|
||||
"bytestring",
|
||||
"cfg-if 1.0.0",
|
||||
"cookie 0.16.2",
|
||||
@@ -262,7 +262,7 @@ dependencies = [
|
||||
"actix-codec",
|
||||
"actix-http",
|
||||
"actix-web",
|
||||
"bytes 1.6.0",
|
||||
"bytes 1.10.0",
|
||||
"bytestring",
|
||||
"futures-core",
|
||||
"pin-project-lite",
|
||||
@@ -297,7 +297,7 @@ dependencies = [
|
||||
"ahash 0.8.11",
|
||||
"arc-swap",
|
||||
"async-trait",
|
||||
"bytes 1.6.0",
|
||||
"bytes 1.10.0",
|
||||
"bytestring",
|
||||
"csv",
|
||||
"derive_more",
|
||||
@@ -605,6 +605,7 @@ version = "0.1.0"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"base64 0.22.1",
|
||||
"bytes 1.10.0",
|
||||
"candle-core",
|
||||
"candle-nn",
|
||||
"candle-transformers",
|
||||
@@ -900,7 +901,7 @@ dependencies = [
|
||||
"async-trait",
|
||||
"axum-core",
|
||||
"bitflags 1.3.2",
|
||||
"bytes 1.6.0",
|
||||
"bytes 1.10.0",
|
||||
"futures-util",
|
||||
"http 0.2.11",
|
||||
"http-body 0.4.6",
|
||||
@@ -926,7 +927,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "759fa577a247914fd3f7f76d62972792636412fbfd634cd452f6a385a74d2d2c"
|
||||
dependencies = [
|
||||
"async-trait",
|
||||
"bytes 1.6.0",
|
||||
"bytes 1.10.0",
|
||||
"futures-util",
|
||||
"http 0.2.11",
|
||||
"http-body 0.4.6",
|
||||
@@ -1350,9 +1351,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "bytes"
|
||||
version = "1.6.0"
|
||||
version = "1.10.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "514de17de45fdb8dc022b1a7975556c53c86f9f0aa5f534b98977b171857c2c9"
|
||||
checksum = "f61dac84819c6588b558454b194026eb1f09c293b9036ae9b159e74e73ab6cf9"
|
||||
dependencies = [
|
||||
"serde",
|
||||
]
|
||||
@@ -1363,7 +1364,7 @@ version = "1.3.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "74d80203ea6b29df88012294f62733de21cfeab47f17b41af3a38bc30a03ee72"
|
||||
dependencies = [
|
||||
"bytes 1.6.0",
|
||||
"bytes 1.10.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -1794,7 +1795,7 @@ version = "4.6.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "35ed6e9d84f0b51a7f52daf1c7d71dd136fd7a3f41a8462b8cdb8c78d920fad4"
|
||||
dependencies = [
|
||||
"bytes 1.6.0",
|
||||
"bytes 1.10.0",
|
||||
"memchr",
|
||||
]
|
||||
|
||||
@@ -2947,7 +2948,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "40d9bd57d914cc66ce878f098f63ed7b5d5b64c30644a5adb950b008f874a6c6"
|
||||
dependencies = [
|
||||
"base64 0.11.0",
|
||||
"bytes 1.6.0",
|
||||
"bytes 1.10.0",
|
||||
"dyn-clone",
|
||||
"lazy_static",
|
||||
"percent-encoding",
|
||||
@@ -4108,7 +4109,7 @@ version = "0.3.26"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "81fe527a889e1532da5c525686d96d4c2e74cdd345badf8dfef9f6b39dd5f5e8"
|
||||
dependencies = [
|
||||
"bytes 1.6.0",
|
||||
"bytes 1.10.0",
|
||||
"fnv",
|
||||
"futures-core",
|
||||
"futures-sink",
|
||||
@@ -4128,7 +4129,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fa82e28a107a8cc405f0839610bdc9b15f1e25ec7d696aa5cf173edbcb1486ab"
|
||||
dependencies = [
|
||||
"atomic-waker",
|
||||
"bytes 1.6.0",
|
||||
"bytes 1.10.0",
|
||||
"fnv",
|
||||
"futures-core",
|
||||
"futures-sink",
|
||||
@@ -4341,7 +4342,7 @@ version = "0.2.11"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8947b1a6fad4393052c7ba1f4cd97bed3e953a95c79c92ad9b051a04611d9fbb"
|
||||
dependencies = [
|
||||
"bytes 1.6.0",
|
||||
"bytes 1.10.0",
|
||||
"fnv",
|
||||
"itoa 1.0.11",
|
||||
]
|
||||
@@ -4352,7 +4353,7 @@ version = "1.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "21b9ddb458710bc376481b842f5da65cdf31522de232c1ca8146abce2a358258"
|
||||
dependencies = [
|
||||
"bytes 1.6.0",
|
||||
"bytes 1.10.0",
|
||||
"fnv",
|
||||
"itoa 1.0.11",
|
||||
]
|
||||
@@ -4363,7 +4364,7 @@ version = "0.4.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7ceab25649e9960c0311ea418d17bee82c0dcec1bd053b5f9a66e265a693bed2"
|
||||
dependencies = [
|
||||
"bytes 1.6.0",
|
||||
"bytes 1.10.0",
|
||||
"http 0.2.11",
|
||||
"pin-project-lite",
|
||||
]
|
||||
@@ -4374,7 +4375,7 @@ version = "1.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1cac85db508abc24a2e48553ba12a996e87244a0395ce011e62b37158745d643"
|
||||
dependencies = [
|
||||
"bytes 1.6.0",
|
||||
"bytes 1.10.0",
|
||||
"http 1.1.0",
|
||||
]
|
||||
|
||||
@@ -4384,7 +4385,7 @@ version = "0.1.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "793429d76616a256bcb62c2a2ec2bed781c8307e797e2598c50010f2bee2544f"
|
||||
dependencies = [
|
||||
"bytes 1.6.0",
|
||||
"bytes 1.10.0",
|
||||
"futures-util",
|
||||
"http 1.1.0",
|
||||
"http-body 1.0.0",
|
||||
@@ -4456,7 +4457,7 @@ version = "0.14.28"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bf96e135eb83a2a8ddf766e426a841d8ddd7449d5f00d34ea02b41d2f19eef80"
|
||||
dependencies = [
|
||||
"bytes 1.6.0",
|
||||
"bytes 1.10.0",
|
||||
"futures-channel",
|
||||
"futures-core",
|
||||
"futures-util",
|
||||
@@ -4480,7 +4481,7 @@ version = "1.3.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fe575dd17d0862a9a33781c8c4696a55c320909004a67a00fb286ba8b1bc496d"
|
||||
dependencies = [
|
||||
"bytes 1.6.0",
|
||||
"bytes 1.10.0",
|
||||
"futures-channel",
|
||||
"futures-util",
|
||||
"h2 0.4.5",
|
||||
@@ -4530,7 +4531,7 @@ version = "0.5.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d6183ddfa99b85da61a140bea0efc93fdf56ceaa041b37d553518030827f9905"
|
||||
dependencies = [
|
||||
"bytes 1.6.0",
|
||||
"bytes 1.10.0",
|
||||
"hyper 0.14.28",
|
||||
"native-tls",
|
||||
"tokio",
|
||||
@@ -4543,7 +4544,7 @@ version = "0.6.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "70206fc6890eaca9fde8a0bf71caa2ddfc9fe045ac9e5c70df101a7dbde866e0"
|
||||
dependencies = [
|
||||
"bytes 1.6.0",
|
||||
"bytes 1.10.0",
|
||||
"http-body-util",
|
||||
"hyper 1.3.1",
|
||||
"hyper-util",
|
||||
@@ -4559,7 +4560,7 @@ version = "0.1.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7b875924a60b96e5d7b9ae7b066540b1dd1cbd90d1828f54c92e02a283351c56"
|
||||
dependencies = [
|
||||
"bytes 1.6.0",
|
||||
"bytes 1.10.0",
|
||||
"futures-channel",
|
||||
"futures-util",
|
||||
"http 1.1.0",
|
||||
@@ -5825,7 +5826,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c9ef834d5ed55e494a2ae350220314dc4aacd1c43a9498b00e320e0ea352a5c3"
|
||||
dependencies = [
|
||||
"byteorder",
|
||||
"bytes 1.6.0",
|
||||
"bytes 1.10.0",
|
||||
"num-rational",
|
||||
"serde",
|
||||
"serde_json",
|
||||
@@ -7234,7 +7235,7 @@ version = "0.12.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "deb1435c188b76130da55f17a466d252ff7b1418b2ad3e037d127b94e3411f29"
|
||||
dependencies = [
|
||||
"bytes 1.6.0",
|
||||
"bytes 1.10.0",
|
||||
"prost-derive",
|
||||
]
|
||||
|
||||
@@ -7373,7 +7374,7 @@ version = "0.11.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8c7c5fdde3cdae7203427dc4f0a68fe0ed09833edc525a03456b153b79828684"
|
||||
dependencies = [
|
||||
"bytes 1.6.0",
|
||||
"bytes 1.10.0",
|
||||
"pin-project-lite",
|
||||
"quinn-proto",
|
||||
"quinn-udp",
|
||||
@@ -7391,7 +7392,7 @@ version = "0.11.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fadfaed2cd7f389d0161bb73eeb07b7b78f8691047a6f3e73caaeae55310a4a6"
|
||||
dependencies = [
|
||||
"bytes 1.6.0",
|
||||
"bytes 1.10.0",
|
||||
"rand 0.8.5",
|
||||
"ring",
|
||||
"rustc-hash",
|
||||
@@ -7872,7 +7873,7 @@ checksum = "dd67538700a17451e7cba03ac727fb961abb7607553461627b97de0b89cf4a62"
|
||||
dependencies = [
|
||||
"async-compression",
|
||||
"base64 0.21.7",
|
||||
"bytes 1.6.0",
|
||||
"bytes 1.10.0",
|
||||
"encoding_rs",
|
||||
"futures-core",
|
||||
"futures-util",
|
||||
@@ -7913,7 +7914,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f8f4955649ef5c38cc7f9e8aa41761d48fb9677197daea9984dc54f56aad5e63"
|
||||
dependencies = [
|
||||
"base64 0.22.1",
|
||||
"bytes 1.6.0",
|
||||
"bytes 1.10.0",
|
||||
"encoding_rs",
|
||||
"futures-channel",
|
||||
"futures-core",
|
||||
@@ -8008,7 +8009,7 @@ checksum = "9008cd6385b9e161d8229e1f6549dd23c3d022f132a2ea37ac3a10ac4935779b"
|
||||
dependencies = [
|
||||
"bitvec",
|
||||
"bytecheck",
|
||||
"bytes 1.6.0",
|
||||
"bytes 1.10.0",
|
||||
"hashbrown 0.12.3",
|
||||
"ptr_meta",
|
||||
"rend",
|
||||
@@ -8117,7 +8118,7 @@ dependencies = [
|
||||
"aws-creds",
|
||||
"aws-region",
|
||||
"base64 0.22.1",
|
||||
"bytes 1.6.0",
|
||||
"bytes 1.10.0",
|
||||
"cfg-if 1.0.0",
|
||||
"futures 0.3.29",
|
||||
"hex",
|
||||
@@ -8149,7 +8150,7 @@ checksum = "b082d80e3e3cc52b2ed634388d436fe1f4de6af5786cc2de9ba9737527bdf555"
|
||||
dependencies = [
|
||||
"arrayvec",
|
||||
"borsh",
|
||||
"bytes 1.6.0",
|
||||
"bytes 1.10.0",
|
||||
"num-traits",
|
||||
"rand 0.8.5",
|
||||
"rkyv",
|
||||
@@ -8284,7 +8285,7 @@ version = "0.11.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "65bc94b580d0f5a6b7a2d604e597513d3c673154b52ddeccd1d5c32360d945ee"
|
||||
dependencies = [
|
||||
"bytes 1.6.0",
|
||||
"bytes 1.10.0",
|
||||
"rxml_validation",
|
||||
]
|
||||
|
||||
@@ -9086,7 +9087,7 @@ dependencies = [
|
||||
"atoi",
|
||||
"bigdecimal",
|
||||
"byteorder",
|
||||
"bytes 1.6.0",
|
||||
"bytes 1.10.0",
|
||||
"chrono",
|
||||
"crc",
|
||||
"crossbeam-queue",
|
||||
@@ -9173,7 +9174,7 @@ dependencies = [
|
||||
"bigdecimal",
|
||||
"bitflags 2.5.0",
|
||||
"byteorder",
|
||||
"bytes 1.6.0",
|
||||
"bytes 1.10.0",
|
||||
"chrono",
|
||||
"crc",
|
||||
"digest 0.10.7",
|
||||
@@ -9896,7 +9897,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "58a998b6be84104ca05c7e9a21f2180ddec020c8b84ea59a8fc8530a2a19588d"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"bytes 1.6.0",
|
||||
"bytes 1.10.0",
|
||||
"dirs 6.0.0",
|
||||
"dunce",
|
||||
"embed_plist",
|
||||
@@ -10374,7 +10375,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e2b070231665d27ad9ec9b8df639893f46727666c6767db40317fbe920a5d998"
|
||||
dependencies = [
|
||||
"backtrace",
|
||||
"bytes 1.6.0",
|
||||
"bytes 1.10.0",
|
||||
"libc",
|
||||
"mio 1.0.2",
|
||||
"parking_lot 0.12.2",
|
||||
@@ -10537,7 +10538,7 @@ version = "0.7.12"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "61e7c3654c13bcd040d4a03abee2c75b1d14a37b423cf5a813ceae1cc903ec6a"
|
||||
dependencies = [
|
||||
"bytes 1.6.0",
|
||||
"bytes 1.10.0",
|
||||
"futures-core",
|
||||
"futures-sink",
|
||||
"pin-project-lite",
|
||||
@@ -10635,7 +10636,7 @@ dependencies = [
|
||||
"async-trait",
|
||||
"axum",
|
||||
"base64 0.21.7",
|
||||
"bytes 1.6.0",
|
||||
"bytes 1.10.0",
|
||||
"h2 0.3.26",
|
||||
"http 0.2.11",
|
||||
"http-body 0.4.6",
|
||||
@@ -11449,7 +11450,7 @@ dependencies = [
|
||||
name = "web_scrapers"
|
||||
version = "0.0.1"
|
||||
dependencies = [
|
||||
"bytes 1.6.0",
|
||||
"bytes 1.10.0",
|
||||
"chrono",
|
||||
"enums",
|
||||
"errors",
|
||||
|
||||
@@ -25,6 +25,7 @@ memory_caching = { path = "../../lib/caching/memory_caching" }
|
||||
|
||||
# External
|
||||
anyhow = "1.0"
|
||||
bytes = "1.10"
|
||||
base64 = "0.22.1"
|
||||
candle-core = { version = "0.8.2", features = ["cuda"] }
|
||||
candle-nn = { version = "0.8.2", features = ["cuda"] }
|
||||
|
||||
@@ -5,8 +5,9 @@ use crate::state::app_config::AppConfig;
|
||||
use crate::state::yaml_config::YamlConfig;
|
||||
use anyhow::Result;
|
||||
use base64::{engine::general_purpose::STANDARD as BASE64_STANDARD, Engine};
|
||||
use bytes::{BufMut, BytesMut};
|
||||
use image::imageops::FilterType;
|
||||
use image::{DynamicImage, EncodableLayout, ImageReader};
|
||||
use image::{DynamicImage, EncodableLayout, ImageFormat, ImageReader};
|
||||
use log::{error, info};
|
||||
use std::io::Cursor;
|
||||
use std::path::PathBuf;
|
||||
@@ -77,23 +78,12 @@ fn do_infer_image(
|
||||
|
||||
match run(args) {
|
||||
Ok(image) => {
|
||||
//info!("Image len: {:?}", image.len());
|
||||
//let bytes = BASE64_STANDARD.encode(image.as_bytes());
|
||||
//// [2025-02-18][04:14:15][app_lib::endpoints::image_endpoint][INFO] First bytes: "DAwODAwNDA"
|
||||
//info!("First bytes: {:?}", bytes.split_at(10).0);
|
||||
|
||||
let mut bytes = Vec::with_capacity(1024*1024);
|
||||
|
||||
let img_data = std::fs::read("temp.png")
|
||||
.map_err(|e| format!("Failed to read generated image: {}", e))?;
|
||||
|
||||
let bytes = BASE64_STANDARD.encode(&img_data);
|
||||
println!("Generated image encoded successfully");
|
||||
|
||||
let _ = std::fs::remove_file("temp.png");
|
||||
|
||||
|
||||
|
||||
image.write_to(&mut Cursor::new(&mut bytes), ImageFormat::Png)
|
||||
.map_err(|err| format!("failure to encode image: {:?}", err))?;
|
||||
|
||||
let bytes = BASE64_STANDARD.encode(bytes);
|
||||
|
||||
Ok(bytes)
|
||||
},
|
||||
|
||||
@@ -110,7 +110,7 @@ pub fn run(args: Args<'_>) -> Result<RgbImage> {
|
||||
println!("Loading input image into tensor...");
|
||||
|
||||
let input_image = dynamic_image_to_tensor(
|
||||
args.image,
|
||||
args.image,
|
||||
&args.configs.device,
|
||||
args.configs.dtype)?;
|
||||
|
||||
@@ -158,7 +158,7 @@ pub fn run(args: Args<'_>) -> Result<RgbImage> {
|
||||
//let mask_latents = (encoded_sample * vae_scale)?.to_device(&args.model_configs.device)?;
|
||||
|
||||
//println!("Mask latents shape: {:?}", mask_latents.shape());
|
||||
|
||||
|
||||
//let timesteps = scheduler.timesteps().to_vec();
|
||||
let timesteps: Vec<_> = scheduler.timesteps().iter().copied().collect();
|
||||
|
||||
@@ -289,10 +289,8 @@ pub fn run(args: Args<'_>) -> Result<RgbImage> {
|
||||
|
||||
//save_image_from_tensor(&image.i(0)?, "temp.png")?;
|
||||
//println!("Image generation completed successfully");
|
||||
|
||||
|
||||
let image = tensor_to_image_buffer(&image.i(0)?)?;
|
||||
|
||||
image.save("temp.png").map_err(E::from)?;
|
||||
|
||||
Ok(image)
|
||||
}
|
||||
Reference in new issue
Block a user