Pedro Cuenca commited on
Commit
0b4b9a3
1 Parent(s): 4325576

Add Again button after first generation.

Browse files

Former-commit-id: c3be8c5392e68f41959d9388a7fd03f821c5da39

Files changed (1) hide show
  1. app/app.py +3 -1
app/app.py CHANGED
@@ -41,7 +41,7 @@ prompt = st.text_input("What do you want to see?")
41
  #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
42
 
43
  DEBUG = False
44
- if prompt != "":
45
  container = st.empty()
46
  container.markdown(f"Generating predictions for: **{prompt}**")
47
 
@@ -56,6 +56,8 @@ if prompt != "":
56
 
57
  container.markdown(f"**{prompt}**")
58
 
 
 
59
  except ServiceError as error:
60
  container.text(f"Service unavailable, status: {error.status_code}")
61
  except KeyError:
 
41
  #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
42
 
43
  DEBUG = False
44
+ if prompt != "" or st.session_state.get("again", False):
45
  container = st.empty()
46
  container.markdown(f"Generating predictions for: **{prompt}**")
47
 
 
56
 
57
  container.markdown(f"**{prompt}**")
58
 
59
+ st.session_state["again"] = st.button('Again!', key='again_button')
60
+
61
  except ServiceError as error:
62
  container.text(f"Service unavailable, status: {error.status_code}")
63
  except KeyError: