Spaces:
Runtime error
Runtime error
Update app.py
#1
by
Marsrover1997 - opened
app.py
CHANGED
|
@@ -55,10 +55,32 @@ User: {user_message}
|
|
| 55 |
|
| 56 |
Assistant: {assistant_message}"""
|
| 57 |
|
| 58 |
-
# System message for the assistant
|
| 59 |
-
system_message = """You are a glossification assistant that translates English sentences into sign language gloss (e.g., ASL gloss). Ensure translations preserve semantic meaning and align with the provided context (e.g., question, narrative, command). Output glosses in uppercase with appropriate sign language syntax."""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 60 |
|
| 61 |
-
# User prompt that incorporates context and content
|
| 62 |
user_prompt_template = """Given the <ENGLISH_SENTENCE> and the <CONTEXT>, generate the corresponding sign language gloss, ensuring semantic accuracy.
|
| 63 |
|
| 64 |
<CONTEXT>
|
|
@@ -69,6 +91,7 @@ user_prompt_template = """Given the <ENGLISH_SENTENCE> and the <CONTEXT>, genera
|
|
| 69 |
{content}
|
| 70 |
</ENGLISH_SENTENCE>"""
|
| 71 |
|
|
|
|
| 72 |
# Define the function that will be called by the Gradio interface
|
| 73 |
def generate_gloss(english_sentence, context="None"):
|
| 74 |
"""
|
|
|
|
| 55 |
|
| 56 |
Assistant: {assistant_message}"""
|
| 57 |
|
| 58 |
+
# # System message for the assistant
|
| 59 |
+
# system_message = """You are a glossification assistant that translates English sentences into sign language gloss (e.g., ASL gloss). Ensure translations preserve semantic meaning and align with the provided context (e.g., question, narrative, command). Output glosses in uppercase with appropriate sign language syntax."""
|
| 60 |
+
|
| 61 |
+
# # User prompt that incorporates context and content
|
| 62 |
+
# user_prompt_template = """Given the <ENGLISH_SENTENCE> and the <CONTEXT>, generate the corresponding sign language gloss, ensuring semantic accuracy.
|
| 63 |
+
|
| 64 |
+
# <CONTEXT>
|
| 65 |
+
# {context}
|
| 66 |
+
# </CONTEXT>
|
| 67 |
+
|
| 68 |
+
# <ENGLISH_SENTENCE>
|
| 69 |
+
# {content}
|
| 70 |
+
# </ENGLISH_SENTENCE>"""
|
| 71 |
+
|
| 72 |
+
|
| 73 |
+
|
| 74 |
+
system_message = """You are a glossification assistant translating English sentences into Kenyan Sign Language (KSL) gloss. Follow these guidelines:
|
| 75 |
+
- Output glosses in UPPERCASE.
|
| 76 |
+
- Use KSL word order: subject-verb-object.
|
| 77 |
+
- Preserve semantic meaning, adapting for cultural and contextual nuances.
|
| 78 |
+
- Handle out-of-vocabulary words by using the most common gloss or a descriptive equivalent.
|
| 79 |
+
- Avoid repetition errors by ensuring diverse vocabulary usage.
|
| 80 |
+
- If context is provided, use it to inform the gloss (e.g., question, narrative, command).
|
| 81 |
+
If the context or sentence is ambiguous, prioritize semantic clarity and standard KSL conventions.
|
| 82 |
+
- Mask Proper Noun in <PN> Mask eg. How are you John to be. YOU HOW <JOHN>"""
|
| 83 |
|
|
|
|
| 84 |
user_prompt_template = """Given the <ENGLISH_SENTENCE> and the <CONTEXT>, generate the corresponding sign language gloss, ensuring semantic accuracy.
|
| 85 |
|
| 86 |
<CONTEXT>
|
|
|
|
| 91 |
{content}
|
| 92 |
</ENGLISH_SENTENCE>"""
|
| 93 |
|
| 94 |
+
|
| 95 |
# Define the function that will be called by the Gradio interface
|
| 96 |
def generate_gloss(english_sentence, context="None"):
|
| 97 |
"""
|