kmaurinjones commited on
Commit
6566362
1 Parent(s): ba79d2d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -41
app.py CHANGED
@@ -17,52 +17,13 @@ delay_min = st.number_input(label = "Minimum delay per iteration. We recommend a
17
  delay_max = st.number_input(label = "Maximum delay per iteration. We recommend a value of at least 10 seconds per song, otherwise you may be banned from azlyrics.com for scraping.",
18
  step = 1., format = "%.2f", value = float(20))
19
 
20
- ######################################################################################################################################################
21
-
22
- # Define a function to handle the state of the input fields
23
- def manage_input_fields(session_state):
24
- if "input_fields" not in session_state:
25
- session_state.input_fields = [{}]
26
-
27
- # Render the input fields
28
- for index, input_field in enumerate(session_state.input_fields):
29
- value = st.text_input(f"Text Input {index + 1}", key=f"text_input_{index}")
30
- input_field["value"] = value
31
-
32
- # Check if the last field is empty and add a new field
33
- if session_state.input_fields[-1]["value"]:
34
- session_state.input_fields.append({})
35
-
36
- # Main function
37
- def main():
38
- st.title("Dynamic Text Inputs with Streamlit")
39
-
40
- # Initialize the session state
41
- if "input_fields" not in st.session_state:
42
- st.session_state.input_fields = []
43
-
44
- # Manage input fields
45
- manage_input_fields(st.session_state)
46
-
47
- # Add a submit button
48
- if st.button("Submit"):
49
- st.write("Values submitted:")
50
- for index, input_field in enumerate(st.session_state.input_fields[:-1]):
51
- st.write(f"Text Input {index + 1}: {input_field['value']}")
52
-
53
- if __name__ == "__main__":
54
- main()
55
-
56
-
57
- ######################################################################################################################################################
58
-
59
  # user-provided data
60
  artist_name = st.text_input("Enter artist name here")
61
  song_1 = st.text_input("Enter 1st song title here", value = "jn mayer") # delete this when done
62
  if song_1:
63
- song_2 = st.text_input("Enter 2nd song title here")
64
  if song_2:
65
- song_3 = st.text_input("Enter 3rd song title here")
66
  if song_3:
67
  song_4 = st.text_input("Enter 4th song title here")
68
  if song_4:
 
17
  delay_max = st.number_input(label = "Maximum delay per iteration. We recommend a value of at least 10 seconds per song, otherwise you may be banned from azlyrics.com for scraping.",
18
  step = 1., format = "%.2f", value = float(20))
19
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
20
  # user-provided data
21
  artist_name = st.text_input("Enter artist name here")
22
  song_1 = st.text_input("Enter 1st song title here", value = "jn mayer") # delete this when done
23
  if song_1:
24
+ song_2 = st.text_input("Enter 2nd song title here", value = "grarvity")
25
  if song_2:
26
+ song_3 = st.text_input("Enter 3rd song title here", "slowin dancing burbg room")
27
  if song_3:
28
  song_4 = st.text_input("Enter 4th song title here")
29
  if song_4: