Elfsong commited on
Commit
8505461
ยท
verified ยท
1 Parent(s): 0c91655

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -3
app.py CHANGED
@@ -76,7 +76,7 @@ max_remaining_time = get_time_remaining(last_start_timestamp, max_run_duration)
76
  # UI
77
  st.image("cover.jpg", caption="Lucky Reactor is currently " + ("running ๐Ÿš€" if status == 'RUNNING' else "sleeping ๐Ÿ˜ด") + ".")
78
 
79
- if status != 'RUNNING':
80
  with st.form("activate_form"):
81
  token = st.text_input("Token (FYI: The reactor costs USD $10 per hour to operate)")
82
  submitted = st.form_submit_button("Ignite ๐Ÿš€")
@@ -85,7 +85,7 @@ if status != 'RUNNING':
85
  st.write("Lucky Reactor has been ignited. Please wait a few minutes (3~5) to preceed...")
86
  response = schedule_server(credentials, instance_name)
87
  response = activate_server(credentials, instance_name)
88
- else:
89
  st.write(f"You can access Lucky Reactor via http://{ip_address}:7860")
90
  st.write(f'Lucky Reactor can still run: {max_remaining_time} s. You can terminate it in advance.')
91
 
@@ -95,4 +95,6 @@ else:
95
 
96
  if submitted and token == os.getenv("EASY_TOKEN"):
97
  st.write("Lucky Reactor has been terminated.")
98
- response = deactivate_server(credentials, instance_name)
 
 
 
76
  # UI
77
  st.image("cover.jpg", caption="Lucky Reactor is currently " + ("running ๐Ÿš€" if status == 'RUNNING' else "sleeping ๐Ÿ˜ด") + ".")
78
 
79
+ if status == 'TERMINATED':
80
  with st.form("activate_form"):
81
  token = st.text_input("Token (FYI: The reactor costs USD $10 per hour to operate)")
82
  submitted = st.form_submit_button("Ignite ๐Ÿš€")
 
85
  st.write("Lucky Reactor has been ignited. Please wait a few minutes (3~5) to preceed...")
86
  response = schedule_server(credentials, instance_name)
87
  response = activate_server(credentials, instance_name)
88
+ elif status == 'RUNNING':
89
  st.write(f"You can access Lucky Reactor via http://{ip_address}:7860")
90
  st.write(f'Lucky Reactor can still run: {max_remaining_time} s. You can terminate it in advance.')
91
 
 
95
 
96
  if submitted and token == os.getenv("EASY_TOKEN"):
97
  st.write("Lucky Reactor has been terminated.")
98
+ response = deactivate_server(credentials, instance_name)
99
+ else:
100
+ st.write(f"Server is [{status}]. Please wait...")