Signed-off-by: Vladimir Mandic <mandic00@live.com>
pull/4228/head
Vladimir Mandic 2025-09-25 14:33:21 -04:00
parent 01e8211d4b
commit ae25cb8880
6 changed files with 10 additions and 11 deletions

View File

@ -7,9 +7,10 @@ const { GoogleGenerativeAI } = require('@google/generative-ai');
const api_key = process.env.GOOGLE_AI_API_KEY;
const model = 'gemini-2.5-flash';
const prompt = `
// eslint-disable-next-line max-len
Translate attached JSON from English to {language} using following rules: fields id, label and reload should be preserved from original, field localized should be a translated version of field label and field hint should be translated in-place. if field is less than 3 characters, do not translate it and keep it as is. Every JSON entry should have id, label, localized, reload and hint fields. Output should be pure JSON without any additional text. To better match translation, context of the text is related to Stable Diffusion and topic of Generative AI.`;
const prompt = `Translate attached JSON from English to {language} using following rules: fields id, label and reload should be preserved from original, field localized should be a translated version of field label and field hint should be translated in-place.
if field is less than 3 characters, do not translate it and keep it as is.
Every JSON entry should have id, label, localized, reload and hint fields.
Output should be pure JSON without any additional text. To better match translation, context of the text is related to Stable Diffusion and topic of Generative AI.`;
const languages = {
hr: 'Croatian',
de: 'German',

View File

@ -440,7 +440,7 @@ class SDNQQuantizer(DiffusersQuantizer):
"""
return missing_keys
def update_state_dict_with_metadata(self, state_dict: dict, metadata: dict) -> dict:
def update_state_dict_with_metadata(self, state_dict: dict, metadata: dict) -> dict: # pylint: disable=unused-argument
"""
needed for transformers compatibilty, no-op function
"""

View File

@ -211,7 +211,7 @@ def create_ui(_blocks: gr.Blocks=None):
gr.HTML('<span id="control-output-button">Output</p>')
with gr.Tabs(elem_classes=['control-tabs'], elem_id='control-tab-output') as output_tabs:
with gr.Tab('Gallery', id='out-gallery'):
output_gallery, output_gen_info, _output_html_info, _output_html_info_formatted, output_html_log = ui_common.create_output_panel("control", preview=False, prompt=prompt, height=gr_height, result_info=result_txt)
output_gallery, _output_gen_info, _output_html_info, _output_html_info_formatted, output_html_log = ui_common.create_output_panel("control", preview=False, prompt=prompt, height=gr_height, result_info=result_txt)
with gr.Tab('Image', id='out-image'):
output_image = gr.Image(label="Output", show_label=False, type="pil", interactive=False, tool="editor", height=gr_height, elem_id='control_output_image', elem_classes=['control-image'])
with gr.Tab('Video', id='out-video'):

View File

@ -1,4 +1,4 @@
from typing import List, Generic, TypeVar, Callable, Union, Any
from typing import List, Generic, TypeVar
import functools
import itertools
@ -23,7 +23,7 @@ class ObjectHooker(Generic[ModuleType]):
def __init__(self, module: ModuleType):
self.module: ModuleType = module
self.hooked = False
self.old_state = dict()
self.old_state = {}
def __enter__(self):
self.hook()
@ -36,7 +36,7 @@ class ObjectHooker(Generic[ModuleType]):
if self.hooked:
raise RuntimeError('Already hooked module')
self.old_state = dict()
self.old_state = {}
self.hooked = True
self._hook_impl()

View File

@ -1,5 +1,5 @@
from pathlib import Path
from typing import List, Type, Any, Dict, Tuple, Union
from typing import List, Type, Any, Dict, Union
import math
from diffusers import StableDiffusionPipeline, StableDiffusionXLPipeline

View File

@ -10,7 +10,6 @@ import matplotlib.pyplot as plt
import numpy as np
import spacy
import torch
import torch.nn.functional as F
__all__ = ['set_seed', 'compute_token_merge_indices', 'plot_mask_heat_map', 'cached_nlp', 'cache_dir', 'auto_device', 'auto_autocast']
@ -102,7 +101,6 @@ def cached_nlp(prompt: str, type='en_core_web_md'):
try:
nlp = spacy.load(type)
except OSError:
import os
os.system(f'python -m spacy download {type}')
nlp = spacy.load(type)