Quick Demo
', unsafe_allow_html=True)
st.markdown('Try a sentence
', unsafe_allow_html=True)
# Demo pills as buttons
cols = st.columns(4)
selected_demo = None
for idx, sentence in enumerate(DEMO_SENTENCES):
with cols[idx % 4]:
if st.button(sentence, key=f"demo_{idx}"):
selected_demo = sentence
st.markdown("", unsafe_allow_html=True) # Input tabs st.markdown('
Translate
', unsafe_allow_html=True)
tab1, tab2 = st.tabs(["๐ Text Input", "๐๏ธ Audio Upload"])
transcript = ""
mode = ""
with tab1:
default_text = selected_demo if selected_demo else ""
txt = st.text_area(
"Enter English text",
value=default_text,
placeholder="Type anything โ e.g. 'Please come here'",
height=100,
label_visibility="collapsed"
)
if st.button("๐ค Translate to ASL", key="text_btn") and txt:
transcript = txt
mode = "Text"
with tab2:
upload = st.file_uploader(
"Upload audio (WAV/MP3)",
type=["wav", "mp3"],
label_visibility="collapsed"
)
if upload and st.button("๐๏ธ Transcribe + Translate", key="audio_btn"):
tmp = "temp_input.wav"
with open(tmp, "wb") as f:
f.write(upload.getbuffer())
with st.spinner("Transcribing with Whisper..."):
try:
transcript = transcribe_file(tmp)
mode = "Audio"
except Exception as e:
st.error(f"Transcription failed: {e}")
finally:
if os.path.exists(tmp):
os.remove(tmp)
if selected_demo and not transcript:
transcript = selected_demo
mode = "Text"
# โโ PIPELINE โโ
if transcript:
st.markdown("", unsafe_allow_html=True) with st.status("โก Running SignLink Pipeline...", expanded=True) as status: st.write("๐ง Generating ASL gloss tokens...") gloss = build_gloss_sequence(transcript, "gemma3n_E2B") st.write("๐๏ธ Retrieving motion capture assets...") dictionary = ASLDictionary() paths = dictionary.get_paths(gloss) status.update(label="โ Translation Complete", state="complete", expanded=False) if paths: try: out_video = stitch_clips(paths) st.video(out_video) except Exception as e: st.error(f"Video rendering error: {e}") # Results card tags_html = "".join([f"{t}" for t in gloss]) st.markdown(f"""
Original Input
"{transcript}"
ASL Gloss Tokens
{tags_html}
โ {len(paths)} clips assembled ยท
Gemma โ Lemmatization โ Fingerspelling fallback