Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -5,19 +5,25 @@ from mhr.predict_tools import MHRStoneRecognizeMgr, MHRVedioCuter
|
|
| 5 |
mgr = MHRStoneRecognizeMgr(
|
| 6 |
whole_pkl = "./whole_model.pkl",
|
| 7 |
hole_pkl = "./hole_model.pkl",
|
| 8 |
-
vedio_cutter =
|
| 9 |
)
|
| 10 |
|
| 11 |
def greet(v):
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 16 |
|
| 17 |
demo = gr.Interface(
|
| 18 |
fn=greet,
|
| 19 |
inputs=gr.Video(),
|
| 20 |
outputs="text",
|
|
|
|
| 21 |
)
|
| 22 |
|
| 23 |
-
demo.launch()
|
|
|
|
| 5 |
mgr = MHRStoneRecognizeMgr(
|
| 6 |
whole_pkl = "./whole_model.pkl",
|
| 7 |
hole_pkl = "./hole_model.pkl",
|
| 8 |
+
vedio_cutter = None,
|
| 9 |
)
|
| 10 |
|
| 11 |
def greet(v):
|
| 12 |
+
result = []
|
| 13 |
+
progress = gr.Progress(0)
|
| 14 |
+
cuter = MHRVedioCuter(5)
|
| 15 |
+
for data in progress.tqdm(cuter.iter(v)):
|
| 16 |
+
ok, ret = mgr.recognize_image(v)
|
| 17 |
+
print(ret)
|
| 18 |
+
result.append(ret)
|
| 19 |
+
|
| 20 |
+
return result
|
| 21 |
|
| 22 |
demo = gr.Interface(
|
| 23 |
fn=greet,
|
| 24 |
inputs=gr.Video(),
|
| 25 |
outputs="text",
|
| 26 |
+
examples = "./example",
|
| 27 |
)
|
| 28 |
|
| 29 |
+
demo.launch(debug=True)
|