seedmanc commited on
Commit
38b31c0
1 Parent(s): 2c8a8d3

Update opp.py

Browse files
Files changed (1) hide show
  1. opp.py +8 -10
opp.py CHANGED
@@ -141,7 +141,6 @@ autoclearLog = True #@param {type:"boolean"}
141
  import csv
142
  import sys
143
  import gradio as gr
144
- from google.colab import output
145
  if DEBUG: print(gr.__version__) #
146
 
147
  def defStats():
@@ -165,13 +164,12 @@ def log(x = '', y = None): # debug only
165
  return x
166
 
167
  global prev_time
168
- with output.use_tags('debug', append=True):
169
- print(f"<\033[94m{sys._getframe( 1).f_back.f_code.co_name}\033[96m => \033[97m{sys._getframe().f_back.f_code.co_name}\033[96m>:")
170
- if x:
171
- print(time.strftime('%M:%S '), x, round(time.time() - prev_time, 3), '\033[0m')
172
- if y:
173
- print(' extra: ', y, '\033[0m')
174
- prev_time = time.time()
175
 
176
  return x
177
 
@@ -452,7 +450,7 @@ def toggleRun(files): # => submit, dataframe, status
452
  log('INTERRUPTED at ss remaining (extra)', eta)
453
  resetStatus()
454
  if (DEBUG and autoclearLog):
455
- output.clear(output_tags='debug')
456
  print('\r')
457
 
458
  clearStats()
@@ -466,7 +464,7 @@ with blks as demo:
466
  with gr.Accordion('README', open=False):
467
  gr.Markdown(description)
468
  if DEBUG and not autoclearLog:
469
- gr.Button('Clear logs').click(lambda: output.clear(output_tags='debug')) #debug
470
  with gr.Row().style(equal_height=False):
471
  with gr.Column(scale=2):
472
  imageinput = gr.Files(file_types=["image"], label="Add images", elem_id="addimg")
 
141
  import csv
142
  import sys
143
  import gradio as gr
 
144
  if DEBUG: print(gr.__version__) #
145
 
146
  def defStats():
 
164
  return x
165
 
166
  global prev_time
167
+ print(f"<\033[94m{sys._getframe( 1).f_back.f_code.co_name}\033[96m => \033[97m{sys._getframe().f_back.f_code.co_name}\033[96m>:")
168
+ if x:
169
+ print(time.strftime('%M:%S '), x, round(time.time() - prev_time, 3), '\033[0m')
170
+ if y:
171
+ print(' extra: ', y, '\033[0m')
172
+ prev_time = time.time()
 
173
 
174
  return x
175
 
 
450
  log('INTERRUPTED at ss remaining (extra)', eta)
451
  resetStatus()
452
  if (DEBUG and autoclearLog):
453
+ os.system('cls' if os.name=='nt' else 'clear')
454
  print('\r')
455
 
456
  clearStats()
 
464
  with gr.Accordion('README', open=False):
465
  gr.Markdown(description)
466
  if DEBUG and not autoclearLog:
467
+ gr.Button('Clear logs').click(lambda: os.system('cls' if os.name=='nt' else 'clear')) #debug
468
  with gr.Row().style(equal_height=False):
469
  with gr.Column(scale=2):
470
  imageinput = gr.Files(file_types=["image"], label="Add images", elem_id="addimg")