File tree Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -9,6 +9,8 @@ function nameWithoutNamespace(modelId: string): string {
99 return splitted . length === 1 ? splitted [ 0 ] : splitted [ 1 ] ;
1010}
1111
12+ const escapeQuotes = ( str : string | undefined ) : string | undefined => str ?. replace ( / " / g, '\\"' ) ;
13+
1214//#region snippets
1315
1416export const adapters = ( model : ModelData ) : string [ ] => [
@@ -141,7 +143,7 @@ const diffusers_default = (model: ModelData) => [
141143
142144pipe = DiffusionPipeline.from_pretrained("${ model . id } ")
143145
144- prompt = "${ get_prompt_from_diffusers_model ( model ) ?? diffusersDefaultPrompt } "
146+ prompt = "${ escapeQuotes ( get_prompt_from_diffusers_model ( model ) ) ?? diffusersDefaultPrompt } "
145147image = pipe(prompt).images[0]` ,
146148] ;
147149
@@ -160,7 +162,7 @@ const diffusers_lora = (model: ModelData) => [
160162pipe = DiffusionPipeline.from_pretrained("${ get_base_diffusers_model ( model ) } ")
161163pipe.load_lora_weights("${ model . id } ")
162164
163- prompt = "${ get_prompt_from_diffusers_model ( model ) ?? diffusersDefaultPrompt } "
165+ prompt = "${ escapeQuotes ( get_prompt_from_diffusers_model ( model ) ) ?? diffusersDefaultPrompt } "
164166image = pipe(prompt).images[0]` ,
165167] ;
166168
You can’t perform that action at this time.
0 commit comments