Spaces:
Sleeping
Sleeping
Commit ·
d2377c0
1
Parent(s): 09c1a2c
updates
Browse files
app.py
CHANGED
|
@@ -55,7 +55,7 @@ def preprocess(filename, max_frames=0, resize=(224,224)):
|
|
| 55 |
video = np.expand_dims(video, axis=0)
|
| 56 |
return video
|
| 57 |
|
| 58 |
-
def translate(video_file):
|
| 59 |
|
| 60 |
video = preprocess(video_file, max_frames=0, resize=(224,224))
|
| 61 |
|
|
@@ -86,6 +86,7 @@ More information about the models can be found in our GitHub repository <a href=
|
|
| 86 |
|
| 87 |
A limitation of this architecture is the size of the MoViNets model, making it especially slow during inference on a CPU.
|
| 88 |
We do not recommend uploading videos longer than 4 seconds as the video embedding generation may take some time.
|
|
|
|
| 89 |
We have provided some pre-cached videos with their original captions and translations as examples.
|
| 90 |
"""
|
| 91 |
|
|
@@ -98,8 +99,6 @@ examples = [
|
|
| 98 |
]
|
| 99 |
|
| 100 |
|
| 101 |
-
article = "More information about the models can be found <a href=https://github.com/deanna-emery/ASL-Translator>here</a>."
|
| 102 |
-
|
| 103 |
article = """The captions for the example videos are as follows in order: \n
|
| 104 |
1. 'My second ASL professor's name was Will White'
|
| 105 |
2. 'You are my sunshine'
|
|
@@ -109,7 +108,7 @@ article = """The captions for the example videos are as follows in order: \n
|
|
| 109 |
|
| 110 |
# Gradio App interface
|
| 111 |
gr.Interface(fn=translate,
|
| 112 |
-
inputs=
|
| 113 |
outputs="text",
|
| 114 |
allow_flagging="never",
|
| 115 |
title=title,
|
|
|
|
| 55 |
video = np.expand_dims(video, axis=0)
|
| 56 |
return video
|
| 57 |
|
| 58 |
+
def translate(video_file, text):
|
| 59 |
|
| 60 |
video = preprocess(video_file, max_frames=0, resize=(224,224))
|
| 61 |
|
|
|
|
| 86 |
|
| 87 |
A limitation of this architecture is the size of the MoViNets model, making it especially slow during inference on a CPU.
|
| 88 |
We do not recommend uploading videos longer than 4 seconds as the video embedding generation may take some time.
|
| 89 |
+
The application does not accept videos that are longer than 10 seconds.
|
| 90 |
We have provided some pre-cached videos with their original captions and translations as examples.
|
| 91 |
"""
|
| 92 |
|
|
|
|
| 99 |
]
|
| 100 |
|
| 101 |
|
|
|
|
|
|
|
| 102 |
article = """The captions for the example videos are as follows in order: \n
|
| 103 |
1. 'My second ASL professor's name was Will White'
|
| 104 |
2. 'You are my sunshine'
|
|
|
|
| 108 |
|
| 109 |
# Gradio App interface
|
| 110 |
gr.Interface(fn=translate,
|
| 111 |
+
inputs=gr.Video(label='Video', show_label=True, max_length=10),
|
| 112 |
outputs="text",
|
| 113 |
allow_flagging="never",
|
| 114 |
title=title,
|