Civarchivist commited on
Commit
d6985b8
·
verified ·
1 Parent(s): 1d121ab

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -0
app.py CHANGED
@@ -1,3 +1,5 @@
 
 
1
  import gradio as gr
2
  import numpy as np
3
  import random
@@ -198,6 +200,18 @@ css = '''
198
  }
199
  '''
200
 
 
 
 
 
 
 
 
 
 
 
 
 
201
  with gr.Blocks(css=css) as demo:
202
  with gr.Column():
203
  input_text = gr.Text("Whatever", interactive = True)
 
1
+ THIS_REPO = "Civarchivist/test_progress"
2
+
3
  import gradio as gr
4
  import numpy as np
5
  import random
 
200
  }
201
  '''
202
 
203
+ error_log = []
204
+
205
+ def log_error(message):
206
+ error_log.append(f"{time.strftime('%Y-%m-%d %H:%M:%S')} - {message}")
207
+ return "\n".join(error_log[-10:]) # Show last 10 errors
208
+
209
+ def restart_space():
210
+ try:
211
+ api.restart_space(repo_id=THIS_REPO, token=os.environ["HF_TOKEN"])
212
+ except Exception as e:
213
+ return log_error(f"Error restarting space: {str(e)}")
214
+
215
  with gr.Blocks(css=css) as demo:
216
  with gr.Column():
217
  input_text = gr.Text("Whatever", interactive = True)