Spaces:
Runtime error
Runtime error
File size: 909 Bytes
a1561e0 5da763a a1561e0 ec76e7d a1561e0 ec76e7d 572054e 8efd70a |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
import os
import streamlit as st
import googleapiclient.discovery
from google.oauth2 import service_account
def auth():
with open("/tmp/token.json", "w") as token_f:
token_f.write("Hello")
return credentials
def get_status(credentials):
status = False
client = googleapiclient.discovery.build('compute', 'v1', credentials=credentials)
result = client.instances().list(project='nus-cisco-corp-lab-wp1', zone='asia-southeast1-c').execute()
for item in result['items']:
if item["name"] == "oj":
status = True if item["status"] == "RUNNING" else False
return status
def activate_server():
return True
st.title("Lucky Reactor")
credentials = auth()
st.image("cover.jpg", caption="Reactor is currently " + "running π" if status else "sleeping π΄" + ".")
if not status:
if st.button("Ignite"):
st.write("Here you go: [LINK]") |