ALGE ist ein KI-basiertes Sprach- und Lernsystem für Kinder mit DLD/SES.
Es kombiniert:
🧸 Raspberry Pi Spielzeug
🌐 Docker Backend Server
🧠 LLM + Memory + Emotion + DLD Engine
🧸 Raspberry Pi (Toy Device)
- Mikrofon
- Lautsprecher
- Wake Word
- Audio Capture
↓ WLAN
🐳 Docker Server (ALGE Core)
- FastAPI Backend
- Memory Engine
- DLD/SES Adapter
- Whisper STT
- Emotion + Confidence
↓
🧠 AI Layer
- GPT / Local LLM
- Kontextanalyse
- Antwortgenerierung
- Lernlogik
docker-compose up --build
version: "3.9"
services:
backend:
build: ./backend
ports:
- "8000:8000"
volumes:
- ./db.sqlite:/app/db.sqlite
restart: always
from fastapi import FastAPI, File, UploadFile, Form
import shutil
app = FastAPI()
@app.post("/chat_audio")
def chat_audio(child_id: str, "temp.wav"
with open(path, "wb") as buffer:
shutil.copyfileobj(file.file, buffer)
text = transcribe_audio(path)
adapted = adapt_text(text)
memory = load_memory(child_id)
response = interpret(adapted, memory)
save_memory(child_id, "last_input", text)
return {
"response": response,
"text": text
}
import sqlite3
def load_memory(child_id):
conn = sqlite3.connect("db.sqlite")
c = conn.cursor()
c.execute("SELECT key,value FROM memory WHERE child_id=?", (child_id,))
return dict(c.fetchall())
def adapt_text(text):
rules = {
"pappen": "krapfen",
"tae": "katze",
"ba": "ball",
"hun": "hund"
}
for k,v in rules.items():
text = text.replace(k,v)
return text
def emotion(text):
if "nicht" in text:
return "frust"
return "neutral"
def confidence(text):
return 0.8 if len(text) > 3 else 0.4
def interpret(text, memory):
prompt = f"""
Kind: {text}
Memory: {memory}
- freundlich antworten
- nicht bewerten
- sanft korrigieren
"""
return "KI Antwort"
import whisper
model = whisper.load_model("base")
def transcribe_audio(path):
return model.transcribe(path, language="de")["text"]
import requests
import sounddevice as sd
from scipy.io.wavfile import write
def record():
audio = sd.rec(16000*4, samplerate=16000, channels=1)
sd.wait()
write("input.wav",16000,audio)
def send():
return requests.post(
"http://SERVER:8000/chat_audio",
files={"file": open("input.wav","rb")},
data={"child_id":"toy_1"}
).json()
from gtts import gTTS
import os
def speak(text):
tts = gTTS(text, lang="de")
tts.save("out.mp3")
os.system("mpg123 out.mp3")
while True:
input("🎮 ENTER drücken")
record()
res = send()
speak(res["response"])
ALGE MASTER ist ein Research-Grade AI Toy System für:
- Sprachtherapie
- Human-AI Interaction
- Assistive Communication
- Educational AI Systems