Ricercar commited on
Commit
861b4f4
1 Parent(s): 4d4e842

test with 1.25 demo

Browse files
Files changed (2) hide show
  1. pages/Gallery.py +10 -10
  2. pages/streamlit-1.25.py +72 -0
pages/Gallery.py CHANGED
@@ -184,15 +184,15 @@ class GalleryApp:
184
  else:
185
  st.caption("`Source: Parti-prompts`")
186
 
187
- # # show image metadata
188
- # image_metadatas = ['prompt_id', 'prompt', 'negativePrompt', 'sampler', 'cfgScale', 'size', 'seed']
189
- # for key in image_metadatas:
190
- # label = ' '.join(key.split('_')).capitalize()
191
- # st.write(f"**{label}**")
192
- # if items[key][0] == ' ':
193
- # st.write('`None`')
194
- # else:
195
- # st.caption(f"{items[key][0]}")
196
 
197
  # for note as civitai image id, add civitai reference
198
  if isinstance(note, str) and note.isdigit():
@@ -423,7 +423,7 @@ def load_hf_dataset():
423
 
424
 
425
  if __name__ == "__main__":
426
- # st.set_page_config(page_title="Model Coffer Gallery", page_icon="🖼️", layout="wide")
427
 
428
  # remove ranking in the session state if it is created in Ranking.py
429
  st.session_state.pop('ranking', None)
 
184
  else:
185
  st.caption("`Source: Parti-prompts`")
186
 
187
+ # show image metadata
188
+ image_metadatas = ['prompt_id', 'prompt', 'negativePrompt', 'sampler', 'cfgScale', 'size', 'seed']
189
+ for key in image_metadatas:
190
+ label = ' '.join(key.split('_')).capitalize()
191
+ st.write(f"**{label}**")
192
+ if items[key][0] == ' ':
193
+ st.write('`None`')
194
+ else:
195
+ st.caption(f"{items[key][0]}")
196
 
197
  # for note as civitai image id, add civitai reference
198
  if isinstance(note, str) and note.isdigit():
 
423
 
424
 
425
  if __name__ == "__main__":
426
+ st.set_page_config(page_title="Model Coffer Gallery", page_icon="🖼️", layout="wide")
427
 
428
  # remove ranking in the session state if it is created in Ranking.py
429
  st.session_state.pop('ranking', None)
pages/streamlit-1.25.py ADDED
@@ -0,0 +1,72 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import datetime
2
+ import time
3
+ import streamlit as st
4
+ import numpy as np
5
+
6
+ st.title("Streamlit App at Hugging Face Spaces!")
7
+ st.image("https://huggingface.co/datasets/huggingface/brand-assets/resolve/main/hf-logo-with-title.png")
8
+
9
+ with st.form("my_form"):
10
+ st.write("Inside the form")
11
+ slider_val = st.slider("Form slider")
12
+ checkbox_val = st.checkbox("Form checkbox")
13
+
14
+ # Every form must have a submit button.
15
+ submitted = st.form_submit_button("Submit")
16
+ if submitted:
17
+ st.write("slider", slider_val, "checkbox", checkbox_val)
18
+
19
+ col1, col2, col3 = st.columns(3)
20
+
21
+ with col1:
22
+ st.image("https://static.streamlit.io/examples/cat.jpg")
23
+
24
+ with col2:
25
+ st.image("https://static.streamlit.io/examples/dog.jpg")
26
+
27
+ with col3:
28
+ st.image("https://static.streamlit.io/examples/owl.jpg")
29
+
30
+ with st.sidebar:
31
+ # st.image("https://huggingface.co/datasets/huggingface/brand-assets/resolve/main/hf-logo.png")
32
+ st.image("https://huggingface.co/datasets/huggingface/brand-assets/resolve/main/hf-logo-with-title.png")
33
+ values = st.slider(
34
+ 'Select a range of values',
35
+ 0.0, 100.0, (25.0, 75.0))
36
+ st.write('Values:', values)
37
+
38
+ appointment = st.slider(
39
+ "Schedule your appointment:",
40
+ value=(datetime.time(11, 30), datetime.time(12, 45)))
41
+ st.write("You're scheduled for:", appointment)
42
+
43
+ start_time = st.slider(
44
+ "When do you start?",
45
+ value=datetime.datetime(2020, 1, 1, 9, 30),
46
+ format="MM/DD/YY - hh:mm")
47
+ st.write("Start time:", start_time)
48
+
49
+ if st.button('Three cheers'):
50
+ st.toast('Hip!')
51
+ time.sleep(.5)
52
+ st.toast('Hip!')
53
+ time.sleep(.5)
54
+ st.toast('Hooray!', icon='🎉')
55
+
56
+ if "chat_messages" not in st.session_state:
57
+ st.session_state.chat_messages = []
58
+
59
+ prompt = st.chat_input("Say something")
60
+ if prompt:
61
+ st.session_state.chat_messages.append({"type": "user", "message": prompt})
62
+ st.session_state.chat_messages.append({"type": "bot", "message": "Hello!", "chart": np.random.randn(30, 3)})
63
+
64
+ for message in st.session_state.chat_messages[::-1]:
65
+ if message["type"] == "user":
66
+ with st.chat_message("You"):
67
+ st.write(message["message"])
68
+ else:
69
+ with st.chat_message("Bot"):
70
+ st.write(message["message"])
71
+ st.line_chart(message["chart"])
72
+