This commit is contained in:
+2
-1
@@ -2,6 +2,7 @@ use crossbeam::atomic::AtomicCell;
|
||||
use df::tract::{mut_slice_as_arrayviewmut, slice_as_arrayview};
|
||||
use df::tract::{DfParams, DfTract, RuntimeParams};
|
||||
use dioxus::prelude::{asset, manganis, Asset};
|
||||
use dioxus_asset_resolver::read_asset_bytes;
|
||||
use std::cell::RefCell;
|
||||
use std::sync::Arc;
|
||||
use tracing::{error, info};
|
||||
@@ -32,7 +33,7 @@ fn with_denoising_model<O>(
|
||||
let cell_task = cell.clone();
|
||||
*state = DenoisingModelState::Downloading(cell);
|
||||
spawn.spawn(async move {
|
||||
let model_bytes = match imp::read_asset_bytes(&DF_MODEL).await {
|
||||
let model_bytes = match read_asset_bytes(&DF_MODEL).await {
|
||||
Ok(b) => b,
|
||||
Err(e) => {
|
||||
error!("could not read denoising model from \"{DF_MODEL}\": {e:?}");
|
||||
|
||||
@@ -311,13 +311,3 @@ pub fn init_logging() {
|
||||
.with_env_filter(env_filter)
|
||||
.init();
|
||||
}
|
||||
|
||||
// TODO: once we update to dioxus 0.7, swap this out with the dioxus-asset-resolver crate
|
||||
pub async fn read_asset_bytes(asset: &dioxus::prelude::Asset) -> color_eyre::Result<Vec<u8>> {
|
||||
let cur_exe = std::env::current_exe().unwrap();
|
||||
let path = cur_exe
|
||||
.parent()
|
||||
.unwrap()
|
||||
.join(asset.to_string().trim_matches('/'));
|
||||
Ok(std::fs::read(&path).with_context(|| format!("native path \"{}\"", path.display()))?)
|
||||
}
|
||||
|
||||
@@ -448,12 +448,6 @@ pub fn init_logging() {
|
||||
info!("logging initiated");
|
||||
}
|
||||
|
||||
// TODO: once we update to dioxus 0.7, swap this out with the dioxus-asset-resolver crate
|
||||
pub async fn read_asset_bytes(asset: &dioxus::prelude::Asset) -> color_eyre::Result<Vec<u8>> {
|
||||
let url = absolute_url(asset.to_string().trim_matches('/'))?;
|
||||
Ok(reqwest::get(url).await?.bytes().await?.to_vec())
|
||||
}
|
||||
|
||||
pub struct SpawnHandle;
|
||||
|
||||
impl SpawnHandle {
|
||||
|
||||
+2
-8
@@ -1,12 +1,6 @@
|
||||
use mumble_web2_gui::{app, imp::init_logging};
|
||||
use mumble_web2_gui::{app, imp};
|
||||
|
||||
pub fn main() {
|
||||
#[cfg(feature = "desktop")]
|
||||
let _guard = tokio::runtime::Builder::new_multi_thread()
|
||||
.enable_all()
|
||||
.build()
|
||||
.unwrap()
|
||||
.enter();
|
||||
init_logging();
|
||||
imp::init_logging();
|
||||
dioxus::launch(app::app);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user