Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -79,13 +79,13 @@ st.image("cover.jpg", caption="Lucky Reactor is currently " + ("running 🚀" if
|
|
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 |
-
running_time = st.select_slider("Running Hours", options=[1,2,3,4,5,6])
|
83 |
submitted = st.form_submit_button("Ignite 🚀")
|
84 |
|
85 |
if submitted and token == os.getenv("EASY_TOKEN"):
|
86 |
st.write("Lucky Reactor has been ignited. Please wait a few minutes (3~5) to preceed...")
|
87 |
-
|
88 |
-
|
89 |
elif status == 'RUNNING':
|
90 |
st.write(f"You can access Lucky Reactor via http://{ip_address}:7860")
|
91 |
st.write(f'The reactor can still run **{max_remaining_time}** s. You can terminate it in advance.')
|
@@ -96,6 +96,6 @@ elif status == 'RUNNING':
|
|
96 |
|
97 |
if terminated_btn and token == os.getenv("EASY_TOKEN"):
|
98 |
st.write("Lucky Reactor has been terminated.")
|
99 |
-
|
100 |
else:
|
101 |
st.write(f"Server is [{status}]. Please wait...")
|
|
|
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 |
+
running_time = st.select_slider("Running Hours (How many hours do you need the reactor)", options=[1,2,3,4,5,6])
|
83 |
submitted = st.form_submit_button("Ignite 🚀")
|
84 |
|
85 |
if submitted and token == os.getenv("EASY_TOKEN"):
|
86 |
st.write("Lucky Reactor has been ignited. Please wait a few minutes (3~5) to preceed...")
|
87 |
+
schedule_response = schedule_server(credentials, instance_name, running_time)
|
88 |
+
activate_response = activate_server(credentials, instance_name)
|
89 |
elif status == 'RUNNING':
|
90 |
st.write(f"You can access Lucky Reactor via http://{ip_address}:7860")
|
91 |
st.write(f'The reactor can still run **{max_remaining_time}** s. You can terminate it in advance.')
|
|
|
96 |
|
97 |
if terminated_btn and token == os.getenv("EASY_TOKEN"):
|
98 |
st.write("Lucky Reactor has been terminated.")
|
99 |
+
deactivate_response = deactivate_server(credentials, instance_name)
|
100 |
else:
|
101 |
st.write(f"Server is [{status}]. Please wait...")
|