Spaces:
Sleeping
Sleeping
Upload folder using huggingface_hub
Browse files
app.py
CHANGED
|
@@ -66,12 +66,12 @@ class SignLanguageVideoProcessor(VideoProcessorBase):
|
|
| 66 |
|
| 67 |
def recv(self, frame: av.VideoFrame) -> av.VideoFrame:
|
| 68 |
img_pil = frame.to_image().convert("RGB")
|
| 69 |
-
|
| 70 |
inputs = self.processor(images=img_pil, return_tensors="pt")
|
| 71 |
with torch.no_grad():
|
| 72 |
outputs = model(**inputs)
|
| 73 |
logits = outputs.logits
|
| 74 |
-
|
| 75 |
predicted_label_index = torch.argmax(logits, dim=1).item()
|
| 76 |
current_predicted_label = self.labels[str(predicted_label_index)]
|
| 77 |
|
|
@@ -164,7 +164,7 @@ if uploaded_file is not None:
|
|
| 164 |
with st.spinner("Translating video... This might take a while depending on video length."):
|
| 165 |
realtime_pred, unique_letters = sign_language_classification_streamlit(video_path)
|
| 166 |
st.success("Translation Complete!")
|
| 167 |
-
|
| 168 |
st.subheader("Last Predicted Sign (from file)")
|
| 169 |
st.write(realtime_pred)
|
| 170 |
|
|
|
|
| 66 |
|
| 67 |
def recv(self, frame: av.VideoFrame) -> av.VideoFrame:
|
| 68 |
img_pil = frame.to_image().convert("RGB")
|
| 69 |
+
|
| 70 |
inputs = self.processor(images=img_pil, return_tensors="pt")
|
| 71 |
with torch.no_grad():
|
| 72 |
outputs = model(**inputs)
|
| 73 |
logits = outputs.logits
|
| 74 |
+
|
| 75 |
predicted_label_index = torch.argmax(logits, dim=1).item()
|
| 76 |
current_predicted_label = self.labels[str(predicted_label_index)]
|
| 77 |
|
|
|
|
| 164 |
with st.spinner("Translating video... This might take a while depending on video length."):
|
| 165 |
realtime_pred, unique_letters = sign_language_classification_streamlit(video_path)
|
| 166 |
st.success("Translation Complete!")
|
| 167 |
+
|
| 168 |
st.subheader("Last Predicted Sign (from file)")
|
| 169 |
st.write(realtime_pred)
|
| 170 |
|