choco-conoz commited on
Commit
daf6a62
·
1 Parent(s): 592ee30

feat: add validatingtext

Browse files
Files changed (1) hide show
  1. src/streamlit_app.py +12 -2
src/streamlit_app.py CHANGED
@@ -48,7 +48,8 @@ def main():
48
  unsafe_allow_html=True
49
  )
50
  st.markdown('<hr />', unsafe_allow_html=True)
51
- query = st.text_input('input your topic of interest')
 
52
 
53
  alpaca_template = """Below is an instruction that describes a task. Write a response that appropriately completes the request.
54
 
@@ -60,7 +61,16 @@ def main():
60
  """
61
 
62
  if st.button("Send"):
63
- with st.snow():
 
 
 
 
 
 
 
 
 
64
  user_prompt = alpaca_template.format(query, "")
65
  if AI_MODE == "ON":
66
  # for chat models
 
48
  unsafe_allow_html=True
49
  )
50
  st.markdown('<hr />', unsafe_allow_html=True)
51
+ query = st.text_input('input your topic of interest. (10 ~ 1000 characters)',
52
+ placeholder='e.g. What is the capital of South Korea?')
53
 
54
  alpaca_template = """Below is an instruction that describes a task. Write a response that appropriately completes the request.
55
 
 
61
  """
62
 
63
  if st.button("Send"):
64
+ if not query:
65
+ st.error("Please enter a query.")
66
+ return
67
+ if len(query) < 10:
68
+ st.error("Please enter a query with at least 10 characters.")
69
+ return
70
+ if len(query) > 1000:
71
+ st.error("Please enter a query with less than 1000 characters.")
72
+ return
73
+ with st.spinner("Generating response..."):
74
  user_prompt = alpaca_template.format(query, "")
75
  if AI_MODE == "ON":
76
  # for chat models