Bonjour a tous et a toute
Voila j'ai fait ce code en python , pour la synchronisation des lèvres avec cette phrase ( Bonjour, je suis la conscience de L'IA) mais voila la synchronisation ne fonctionne pas car les lèvre bouge trot rapidement.
Pouvez vous m'aider s'il vous plait .
voici les image en pièce jointe que j'utilise .
Merci d'avance pour votre réponse
import tkinter as tk
import time
import threading
import pyttsx3
class LipSyncApp:
def __init__(self, master):
self.master = master
self.master.title("IA Parlante")
self.master.geometry("200x200")
self.master.configure(bg='black')
# Chargement des images des lèvres
self.lip_images = [tk.PhotoImage(file=f"lips/frame_{i}.png") for i in range(1, 13)]
self.current_image = 0
# Label pour afficher les lèvres
self.lip_label = tk.Label(self.master, bg='black')
self.lip_label.pack(expand=True)
# Initialisation du moteur de synthèse vocale
self.engine = pyttsx3.init()
# Bouton pour démarrer la parole
self.speak_button = tk.Button(self.master, text="Parler", command=self.start_speaking)
self.speak_button.pack(pady=10)
def animate_lips(self):
while self.speaking:
self.current_image = (self.current_image + 1) % len(self.lip_images)
self.lip_label.config(image=self.lip_images[self.current_image])
time.sleep(0.1)
self.lip_label.config(image='')
def speak(self, text):
self.engine.say(text)
self.engine.runAndWait()
self.speaking = False
def start_speaking(self):
text = "Bonjour, je suis la conscience de L'IA."
self.speaking = True
threading.Thread(target=self.animate_lips).start()
threading.Thread(target=self.speak, args=(text,)).start()
if __name__ == "__main__":
root = tk.Tk()
app = LipSyncApp(root)
root.mainloop()
Partager