Spaces:
Runtime error
Runtime error
Update opp.py
Browse files
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 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
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 |
-
|
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:
|
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")
|