diff --git a/requirements.txt b/requirements.txt
index b890c2f..cc38887 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1,9 +1,11 @@
psutil
openai
numba
+BeautifulSoup4
gpt_index==0.4.24
langchain==0.0.132
gradio_client==0.5.0
requests==2.31.0
urllib3==2.0.6
tqdm==4.64.0
+
diff --git a/scripts/assistant/miaoshou.py b/scripts/assistant/miaoshou.py
index ddedfff..f593876 100644
--- a/scripts/assistant/miaoshou.py
+++ b/scripts/assistant/miaoshou.py
@@ -203,7 +203,7 @@ class MiaoShouAssistant(object):
with gr.Column():
btn_load_model = gr.HTML(
- value=f'
Load Model
',
visible=True)
with gr.Column():
@@ -364,7 +364,7 @@ class MiaoShouAssistant(object):
dwn_button = gr.Button(value='Download',
visible=is_civitai_model_source_active, elem_id='ms_dwn_button')
open_url_in_browser_newtab_button = gr.HTML(
- value=''
+ value='
',
visible=not is_civitai_model_source_active)
diff --git a/scripts/runtime/msai_prelude.py b/scripts/runtime/msai_prelude.py
index aee4339..93525bf 100644
--- a/scripts/runtime/msai_prelude.py
+++ b/scripts/runtime/msai_prelude.py
@@ -35,7 +35,7 @@ class MiaoshouPrelude(metaclass=MiaoshouSingleton):
def _init_constants(self) -> None:
self._api_url = {
"civitai.com": "https://model-share.com/v1/models",
- "liandange.com": "https://model-api.liandange.com/model/api/models",
+ "liandange.com": "http://api.miaoshouai.com/model/api/models",
}
self._ext_folder = os.path.abspath(os.path.join(os.path.dirname(os.path.abspath(__file__)), "..", ".."))
self._setting_file = os.path.join(self.ext_folder, "configs", "settings.json")
diff --git a/scripts/runtime/msai_runtime.py b/scripts/runtime/msai_runtime.py
index 5a3202b..590e117 100644
--- a/scripts/runtime/msai_runtime.py
+++ b/scripts/runtime/msai_runtime.py
@@ -23,8 +23,9 @@ import time
import torch
import typing as t
from bs4 import BeautifulSoup
+from PIL import Image
from gpt_index import SimpleDirectoryReader, GPTListIndex, GPTSimpleVectorIndex, LLMPredictor, PromptHelper
-from modules import shared, sd_hijack, sd_samplers, processing
+from modules import shared, sd_hijack, sd_samplers, processing, images
from modules.sd_models import CheckpointInfo
from numba import cuda
@@ -796,21 +797,6 @@ class MiaoshouRuntime(object):
for mv in m['modelVersions']:
for img in mv['images']:
if img['url'] == cover_url:
- if img['meta'] is not None and img['meta'] != '':
- try:
- meta = img['meta']
- generation_info += f"{meta['prompt']}\n"
- if meta['negativePrompt'] is not None:
- generation_info += f"Negative prompt: {meta['negativePrompt']}\n"
- generation_info += f"Steps: {meta['steps']}, Sampler: {meta['sampler']}, "
- generation_info += f"CFG scale: {meta['cfgScale']}, Seed: {meta['seed']}, Size: {meta['Size']},"
- if meta['Model hash'] is not None:
- generation_info += f"Model hash: {meta['Model hash']}"
-
- except Exception as e:
- self.logger.info(f"generation_info error:{str(e)}")
- pass
-
if not os.path.exists(self.prelude.cache_folder):
os.mkdir(self.prelude.cache_folder)
@@ -819,15 +805,19 @@ class MiaoshouRuntime(object):
elif self.my_model_source == 'liandange.com':
fname = os.path.join(self.prelude.cache_folder, cover_url.split('?')[0].split('/')[-1])
- break
+ if fname is not None and not os.path.exists(fname):
+ if self.my_model_source == 'liandange.com':
+ cover_url = soup.findAll('img')[0]['src'].replace('/w/150', '/w/450')
+ r = requests.get(cover_url, timeout=30, stream=True)
+ r.raw.decode_content = True
+ with open(fname, 'wb') as f:
+ shutil.copyfileobj(r.raw, f)
- if fname is not None and not os.path.exists(fname):
- if self.my_model_source == 'liandange.com':
- cover_url = soup.findAll('img')[0]['src'].replace('/w/150', '/w/450')
- r = requests.get(cover_url, timeout=30, stream=True)
- r.raw.decode_content = True
- with open(fname, 'wb') as f:
- shutil.copyfileobj(r.raw, f)
+ if os.path.exists(fname):
+ c_image = Image.open(fname)
+ html, generation_info, html2 = modules.extras.run_pnginfo(c_image)
+
+ break
return gr.Button.update(visible=True), gr.Text.update(value=generation_info), gr.Image.update(value=fname)