Spaces:
Running
Running
Update Gallery.py
Browse files- pages/Gallery.py +14 -6
pages/Gallery.py
CHANGED
@@ -203,6 +203,15 @@ class GalleryApp:
|
|
203 |
prompt_id = items['prompt_id'].unique()[0]
|
204 |
note = items['note'].unique()[0]
|
205 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
206 |
# show image metadata
|
207 |
image_metadatas = ['prompt_id', 'prompt', 'negativePrompt', 'sampler', 'cfgScale', 'size', 'seed']
|
208 |
for key in image_metadatas:
|
@@ -216,7 +225,7 @@ class GalleryApp:
|
|
216 |
# for note as civitai image id, add civitai reference
|
217 |
if isinstance(note, str) and note.isdigit():
|
218 |
try:
|
219 |
-
st.write('**Civitai Reference**')
|
220 |
res = requests.get(f'https://civitai.com/images/{note}')
|
221 |
# st.write(res.text)
|
222 |
soup = BeautifulSoup(res.text, 'html.parser')
|
@@ -241,11 +250,10 @@ class GalleryApp:
|
|
241 |
for prompt_tag in prompt_tags:
|
242 |
unsafe_prompts[prompt_tag] = []
|
243 |
# manually add unsafe prompts
|
244 |
-
unsafe_prompts['
|
245 |
-
unsafe_prompts['
|
246 |
-
unsafe_prompts['
|
247 |
-
unsafe_prompts['
|
248 |
-
unsafe_prompts['food'] = [34]
|
249 |
|
250 |
if int(prompt_id.item()) in unsafe_prompts[tag]:
|
251 |
st.warning('This prompt may contain unsafe content. They might be offensive, depressing, or sexual.')
|
|
|
203 |
prompt_id = items['prompt_id'].unique()[0]
|
204 |
note = items['note'].unique()[0]
|
205 |
|
206 |
+
# show source
|
207 |
+
if isinstance(note, str):
|
208 |
+
if note.isdigit():
|
209 |
+
st.caption(f"`Source: civitai`")
|
210 |
+
else:
|
211 |
+
st.caption(f"`Source: {note}`")
|
212 |
+
else:
|
213 |
+
st.caption("`Source: Parti-prompts`")
|
214 |
+
|
215 |
# show image metadata
|
216 |
image_metadatas = ['prompt_id', 'prompt', 'negativePrompt', 'sampler', 'cfgScale', 'size', 'seed']
|
217 |
for key in image_metadatas:
|
|
|
225 |
# for note as civitai image id, add civitai reference
|
226 |
if isinstance(note, str) and note.isdigit():
|
227 |
try:
|
228 |
+
st.write(f'**[Civitai Reference](https://civitai.com/images/{note})**')
|
229 |
res = requests.get(f'https://civitai.com/images/{note}')
|
230 |
# st.write(res.text)
|
231 |
soup = BeautifulSoup(res.text, 'html.parser')
|
|
|
250 |
for prompt_tag in prompt_tags:
|
251 |
unsafe_prompts[prompt_tag] = []
|
252 |
# manually add unsafe prompts
|
253 |
+
unsafe_prompts['world knowledge'] = [83]
|
254 |
+
# unsafe_prompts['art'] = [23]
|
255 |
+
unsafe_prompts['abstract'] = [1, 3]
|
256 |
+
# unsafe_prompts['food'] = [34]
|
|
|
257 |
|
258 |
if int(prompt_id.item()) in unsafe_prompts[tag]:
|
259 |
st.warning('This prompt may contain unsafe content. They might be offensive, depressing, or sexual.')
|