Spaces:
Sleeping
Sleeping
Commit
·
1b98eb0
1
Parent(s):
c23b48c
最終修復
Browse files
app.py
CHANGED
|
@@ -903,12 +903,15 @@ def process_video():
|
|
| 903 |
# 嘗試從辨識結果中提取單詞序列(簡單的文字分割)
|
| 904 |
if recognition_result and recognition_result != "無法辨識手語內容":
|
| 905 |
# 如果結果包含多個詞,可以分割
|
| 906 |
-
|
| 907 |
-
|
| 908 |
-
word_sequence = potential_words
|
| 909 |
else:
|
| 910 |
-
#
|
| 911 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 912 |
|
| 913 |
# 使用 GPT 生成完整句子(而不是直接複製辨識結果)
|
| 914 |
video_recognizer = VideoSignLanguageRecognizer(model_path, threshold=0.5)
|
|
|
|
| 903 |
# 嘗試從辨識結果中提取單詞序列(簡單的文字分割)
|
| 904 |
if recognition_result and recognition_result != "無法辨識手語內容":
|
| 905 |
# 如果結果包含多個詞,可以分割
|
| 906 |
+
if isinstance(recognition_result, list):
|
| 907 |
+
potential_words = recognition_result # 如果是列表,直接使用
|
|
|
|
| 908 |
else:
|
| 909 |
+
potential_words = recognition_result.split() # 如果是字符串,使用 split()
|
| 910 |
+
if len(potential_words) <= 4: # 假設是單詞序列
|
| 911 |
+
word_sequence = potential_words
|
| 912 |
+
else:
|
| 913 |
+
# 否則視為生成的句子
|
| 914 |
+
word_sequence = [recognition_result.split()[0]] if recognition_result.split() else []
|
| 915 |
|
| 916 |
# 使用 GPT 生成完整句子(而不是直接複製辨識結果)
|
| 917 |
video_recognizer = VideoSignLanguageRecognizer(model_path, threshold=0.5)
|