Skip to content

Commit

Permalink
refactored settings
Browse files Browse the repository at this point in the history
* added isModelInCache to ModelOptions.vue
* added HasFiles to CacheManager class
* added AppActions
* added AppOptions
* added CreationParams
* added MutationRates
  • Loading branch information
cristianglezm committed Nov 14, 2024
1 parent 20fd100 commit aedc2f0
Show file tree
Hide file tree
Showing 10 changed files with 1,083 additions and 723 deletions.
12 changes: 6 additions & 6 deletions TODO.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

* [x] cache manager (to delete models files)
* [x] make model options component for settings
* [ ] refactor settings - split into components?
- [ ] AppOptions
- [ ] CreationParams
- [ ] mutationsRates
- [ ] AppActions
- [ ] make new layout for settings?
* [x] refactor settings - split into components
- [x] AppOptions
- [x] CreationParams
- [x] mutationsRates
- [x] AppActions
- [x] make new layout for settings
* [x] change xenova/transformers to huggingface/transformers
- [x] adapt code for it
* [ ] test all models
Expand Down
84 changes: 42 additions & 42 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

<script setup>
import { onMounted, inject } from 'vue';
import { onMounted, inject, onUnmounted } from 'vue';
import ProgressModal from './components/ProgressModal.vue';
import MultiProgressNodal from './components/MultiProgressModal.vue';
import DescriptionModal from './components/DescriptionModal.vue';
Expand All @@ -29,57 +29,57 @@ const emitter = inject('emitter');
const store = useFlowersStore();
const AIStore = useAIStore();
emitter.on('loadModel', () => {
setTimeout(() => {
emitter.emit('requestMultiProgressBar', {
status: "setup",
title: "downloading or loading model for describing flowers",
onLoad: async () => {
Captioner.setModelOptions(AIStore.modelOptions);
Captioner.getInstance((data) => {
switch(data.status){
case "initiate":{
let event = {
status: "init",
name: data.file,
progress: 0,
total: 100
};
emitter.emit('requestMultiProgressBar', event);
}
break;
case "progress":{
let event = {
status: "update",
name: data.file,
progress: data.progress
};
emitter.emit('requestMultiProgressBar', event);
}
break;
case "done":{
emitter.emit('ModelOptions#updateBtnTitle', {
title: "load model"
});
}
}
});
}
});
}, 2000);
});
const isLocal = () => {
return routes.path === '/Local' ||
routes.path === '/Favourites' ||
routes.params.isLocal === 'local' ||
routes.path === '/Settings';
};
onMounted(() => {
emitter.on('App#loadModel', () => {
setTimeout(() => {
emitter.emit('requestMultiProgressBar', {
status: "setup",
title: "downloading or loading model for describing flowers",
onLoad: async () => {
Captioner.setModelOptions(AIStore.modelOptions);
Captioner.getInstance((data) => {
switch(data.status){
case "initiate":{
let event = {
status: "init",
name: data.file,
progress: 0,
total: 100
};
emitter.emit('requestMultiProgressBar', event);
}
break;
case "progress":{
let event = {
status: "update",
name: data.file,
progress: data.progress
};
emitter.emit('requestMultiProgressBar', event);
}
break;
case "done":{
emitter.emit('ModelOptions#updateBtnTitle');
}
}
});
}
});
}, 2000);
});
if(store.settings.loadModel){
emitter.emit('loadModel');
emitter.emit('App#loadModel');
}
})
onUnmounted(() => {
emitter.off("App#loadModel");
})
/*!
* @license SIL Open Font License 1.1 - Copyright (c) 2023, GitHub
Expand Down
Loading

0 comments on commit aedc2f0

Please sign in to comment.