Views
No views yet
1from transformers import AutoModelForCausalLM, AutoTokenizer
2
3model = AutoModelForCausalLM.from_pretrained("0xroyce/silent-voice-multimodal")
4tokenizer = AutoTokenizer.from_pretrained("0xroyce/silent-voice-multimodal")
5
6# Example: Emergency situation
7prompt = """Biosignal: Sustained gaze at top_left for 2s + Facial expression: severe pain
8Context: ICU, ALS patient (advanced stage)
9Urgency: critical"""
10
11inputs = tokenizer(prompt, return_tensors="pt")
12outputs = model.generate(**inputs, max_new_tokens=50)
13response = tokenizer.decode(outputs[0], skip_special_tokens=True)
14print(response)
15# Output: "I'm in severe pain! Please check my medication immediately!"1# Sustained gaze patterns
2prompt = """Biosignal: Sustained gaze at top_left for 2s
3Context: home, stroke patient
4Urgency: high"""
5# → "I need help urgently!"
6
7prompt = """Biosignal: Double blink detected
8Context: bedroom, cerebral_palsy patient
9Urgency: low"""
10# → "Yes, that's correct"
11
12prompt = """Biosignal: Rapid blinking for 3s
13Context: hospital_bed, ALS patient
14Urgency: critical"""
15# → "I'm in severe pain! Please get help immediately!"1# Facial muscles
2prompt = """Biosignal: EMG signal: jaw clench detected
3Context: home, stroke patient
4Urgency: low"""
5# → "Yes, I understand"
6
7prompt = """Biosignal: EMG signal: eyebrow raise detected
8Context: therapy_session, cerebral_palsy patient
9Urgency: low"""
10# → "I have a question about this exercise"
11
12# Minimal movements
13prompt = """Biosignal: EMG signal: finger twitch detected
14Context: home, ALS patient (early stage)
15Urgency: low"""
16# → "Please select this option"1# Emergency
2prompt = """Biosignal: Eye tracking: rapid blinking + EMG: jaw clench + Facial expression: severe pain
3Context: hospital_bed, ALS patient (advanced stage)
4Urgency: critical"""
5# → "I'm in severe pain! Please get help immediately! Check my medication schedule!"
6
7# Daily care
8prompt = """Biosignal: Sustained gaze at window + Facial expression: moderate happiness
9Context: living_room, cerebral_palsy patient
10Urgency: low"""
11# → "I'd like the curtains opened please. The sunshine would be nice."
12
13# Complex communication
14prompt = """Biosignal: Eye tracking: look at water bottle + EMG: weak jaw movement + Facial expression: concentration
15Context: therapy_session, stroke patient
16Urgency: medium"""
17# → "I'm thirsty and would like some water during our session"1# Contextual communication
2context_prompt = """Biosignal: Sustained gaze at kitchen + Facial expression: moderate hunger
3Context: home, cerebral_palsy patient
4Urgency: low"""
5# → "Good morning! I'm feeling hungry and would appreciate breakfast when convenient."
6
7# Emergency situations
8emergency_prompt = """Biosignal: Eye tracking: rapid blinking + EMG: all muscles tensed + Facial expression: severe distress
9Context: home_alone, ALS patient (advanced stage)
10Urgency: critical"""
11# → "EMERGENCY! I need immediate medical assistance! Please call for help NOW!"
12
13# Pain management
14pain_prompt = """Biosignal: Facial expression: moderate pain + EMG: jaw clench
15Context: hospital_bed, stroke patient
16Urgency: high"""
17# → "I'm experiencing significant pain. Could you please check my medication schedule?"
Input: Biosignal: EMG signal: slight muscle tension + Facial expression: mild discomfort
Context: bedroom, ALS patient (moderate stage)
Urgency: medium
Output: Good morning! I'm getting a bit stiff lying here. Could you help me change position when you have a moment?
Input: Biosignal: Sustained gaze at food + EMG: weak jaw movement
Context: dining_room, stroke patient
Urgency: low
Output: I'm ready to eat now. Could we start with something soft?Input: Biosignal: Sustained gaze at medication + EMG: jaw clench
Context: bedroom, cerebral_palsy patient
Urgency: medium
Output: It's time for my medication. Please check the schedule.
Input: Biosignal: Facial expression: moderate pain + EMG: abdominal tension
Context: hospital_bed, stroke patient
Urgency: high
Output: I'm experiencing stomach discomfort. It might be related to my medication.Input: Biosignal: Sustained gaze at person + Facial expression: moderate happiness
Context: with_family, ALS patient (advanced stage)
Urgency: low
Output: I love you. Thank you for being here with me.
Input: Biosignal: Facial expression: tears + EMG: relaxed baseline
Context: with_family, stroke patient
Urgency: low
Output: I'm feeling emotional but okay. These are happy tears.1@misc{silent-voice-2025,
2 title={Silent Voice: Neural Translation of Biosignals for Paralyzed Patients},
3 author=0xroyce,
4 year={2025},
5 publisher={HuggingFace},
6 howpublished={\url{https://huggingface.co/0xroyce/silent-voice-multimodal}}
7}