Spaces:
Runtime error
Runtime error
Update app.py
Browse files
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
|
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 |
-
|
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...")
|