Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -16,32 +16,15 @@ def greet(v, progress=gr.Progress(track_tqdm=True)):
|
|
| 16 |
cuter = MHRVedioCuter(5)
|
| 17 |
print(type(cuter.iter(v)))
|
| 18 |
for data in progress.tqdm(cuter.iter(v)):
|
| 19 |
-
print(type(data))
|
| 20 |
ok, ret = mgr.recognize_image(data)
|
| 21 |
-
|
|
|
|
| 22 |
result.append(ret)
|
| 23 |
return result
|
| 24 |
|
| 25 |
-
def greet2(v):
|
| 26 |
-
print("v:", v)
|
| 27 |
-
ret = mgr.recognize(v)
|
| 28 |
-
print(ret)
|
| 29 |
-
return ret
|
| 30 |
-
|
| 31 |
-
def greet3(x, progress=gr.Progress()):
|
| 32 |
-
progress(0, desc="Starting...")
|
| 33 |
-
time.sleep(1)
|
| 34 |
-
for i in progress.tqdm(range(100)):
|
| 35 |
-
time.sleep(0.1)
|
| 36 |
-
return x
|
| 37 |
-
|
| 38 |
-
print("1:", os.path.dirname(__file__))
|
| 39 |
-
print("2:", os.path.join(os.path.dirname(__file__), "example/test.mp4") )
|
| 40 |
-
|
| 41 |
with gr.Blocks() as demo:
|
| 42 |
with gr.Row():
|
| 43 |
input = gr.Video()
|
| 44 |
-
#input = [gr.Textbox()]
|
| 45 |
output = [gr.Textbox()]
|
| 46 |
btn = gr.Button(value="Submit")
|
| 47 |
btn.click(greet, inputs=input, outputs=output)
|
|
@@ -54,26 +37,3 @@ with gr.Blocks() as demo:
|
|
| 54 |
cache_examples=False,
|
| 55 |
)
|
| 56 |
demo.queue().launch(debug=True)
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
#def my_function(x,y, progress=gr.Progress()):
|
| 60 |
-
# progress(0, desc="Starting...")
|
| 61 |
-
# time.sleep(1)
|
| 62 |
-
# for i in progress.tqdm(range(100)):
|
| 63 |
-
# time.sleep(0.1)
|
| 64 |
-
# return x+y
|
| 65 |
-
#with gr.Blocks() as demo:
|
| 66 |
-
# with gr.Row():
|
| 67 |
-
# input1 = gr.Textbox()
|
| 68 |
-
# input2 = gr.Textbox()
|
| 69 |
-
# output = gr.Textbox()
|
| 70 |
-
# btn = gr.Button(value="Submit")
|
| 71 |
-
# btn.click(my_function, inputs=[input1,input2], outputs=output)
|
| 72 |
-
# gr.Examples(
|
| 73 |
-
# [["hi", "Adam"], ["hello", "Eve"]],
|
| 74 |
-
# [input1, input2],
|
| 75 |
-
# output,
|
| 76 |
-
# my_function,
|
| 77 |
-
# cache_examples=False,
|
| 78 |
-
# )
|
| 79 |
-
#demo.queue().launch()
|
|
|
|
| 16 |
cuter = MHRVedioCuter(5)
|
| 17 |
print(type(cuter.iter(v)))
|
| 18 |
for data in progress.tqdm(cuter.iter(v)):
|
|
|
|
| 19 |
ok, ret = mgr.recognize_image(data)
|
| 20 |
+
if (len(result) > 0 and result[-1][-1] == ret[-1] and result[-1][-2] == ret[-2]):
|
| 21 |
+
continue
|
| 22 |
result.append(ret)
|
| 23 |
return result
|
| 24 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 25 |
with gr.Blocks() as demo:
|
| 26 |
with gr.Row():
|
| 27 |
input = gr.Video()
|
|
|
|
| 28 |
output = [gr.Textbox()]
|
| 29 |
btn = gr.Button(value="Submit")
|
| 30 |
btn.click(greet, inputs=input, outputs=output)
|
|
|
|
| 37 |
cache_examples=False,
|
| 38 |
)
|
| 39 |
demo.queue().launch(debug=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|