Pedro Cuenca commited on
Commit
a7f2bba
1 Parent(s): bb7c400

Progress indicator follows current theme.

Browse files

I tried to use
`components.streamlit.config.get_options_for_section("theme")` but all
returned keys are `None`.

What I did instead was to copy the style definitions used by streamlit.

This implementation uses the same style as `streamlit.info`. An
alternative would be `streamlit.warning`, but it really looks more like
a warning.

Files changed (1) hide show
  1. app/app.py +19 -12
app/app.py CHANGED
@@ -55,24 +55,31 @@ st.subheader('Generate images from text')
55
 
56
  prompt = st.text_input("What do you want to see?")
57
 
58
- #TODO: I think there's an issue where we can't run twice the same inference (not due to caching) - may need to use st.form
59
-
60
  DEBUG = False
61
  if prompt != "" or (should_run_again and prompt != ""):
62
  container = st.empty()
 
 
 
63
  container.markdown(f"""
64
- <style> p {{ margin:0 }} </style>
65
- <p style="background-color:#FCF3CF;">
66
- <img src="https://raw.githubusercontent.com/borisdayma/dalle-mini/main/app/img/loading.gif" width="30"/>
67
- Generating predictions for: <b>{prompt}</b>
68
- </p>
 
 
 
 
 
 
 
 
 
 
69
  <small><i>Predictions may take up to 40s under high load. Please, stand by.</i></small>
70
  """, unsafe_allow_html=True)
71
- # container.markdown("more markdown")
72
-
73
- # container.markdown(f"Generating predictions for: **{prompt}**")
74
- # container.info(f"this is an info field")
75
- # container.warning(f"this is a warning field")
76
 
77
  try:
78
  backend_url = st.secrets["BACKEND_SERVER"]
 
55
 
56
  prompt = st.text_input("What do you want to see?")
57
 
58
+ test = st.empty()
 
59
  DEBUG = False
60
  if prompt != "" or (should_run_again and prompt != ""):
61
  container = st.empty()
62
+ # The following mimics `streamlit.info()`.
63
+ # I tried to get the secondary background color using `components.streamlit.config.get_options_for_section("theme")["secondaryBackgroundColor"]`
64
+ # but it returns None.
65
  container.markdown(f"""
66
+ <style> p {{ margin:0 }} div {{ margin:0 }} </style>
67
+ <div data-stale="false" class="element-container css-1e5imcs e1tzin5v1">
68
+ <div class="stAlert">
69
+ <div role="alert" data-baseweb="notification" class="st-ae st-af st-ag st-ah st-ai st-aj st-ak st-g3 st-am st-b8 st-ao st-ap st-aq st-ar st-as st-at st-au st-av st-aw st-ax st-ay st-az st-b9 st-b1 st-b2 st-b3 st-b4 st-b5 st-b6">
70
+ <div class="st-b7">
71
+ <div class="css-whx05o e13vu3m50">
72
+ <div data-testid="stMarkdownContainer" class="css-1ekf893 e16nr0p30">
73
+ <img src="https://raw.githubusercontent.com/borisdayma/dalle-mini/main/app/img/loading.gif" width="30"/>
74
+ Generating predictions for: <b>{prompt}</b>
75
+ </div>
76
+ </div>
77
+ </div>
78
+ </div>
79
+ </div>
80
+ </div>
81
  <small><i>Predictions may take up to 40s under high load. Please, stand by.</i></small>
82
  """, unsafe_allow_html=True)
 
 
 
 
 
83
 
84
  try:
85
  backend_url = st.secrets["BACKEND_SERVER"]