Instructions to use marcosremar2/MuseTalk1.5 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Diffusers
How to use marcosremar2/MuseTalk1.5 with Diffusers:
pip install -U diffusers transformers accelerate
import torch from diffusers import DiffusionPipeline # switch to "mps" for apple devices pipe = DiffusionPipeline.from_pretrained("marcosremar2/MuseTalk1.5", dtype=torch.bfloat16, device_map="cuda") prompt = "Astronaut in a jungle, cold color palette, muted colors, detailed, 8k" image = pipe(prompt).images[0] - Notebooks
- Google Colab
- Kaggle
| import { useState, useRef, useCallback } from 'react' | |
| export function useMediaRecorder(onRecordingComplete) { | |
| const [isRecording, setIsRecording] = useState(false) | |
| const [error, setError] = useState(null) | |
| const mediaRecorderRef = useRef(null) | |
| const streamRef = useRef(null) | |
| const chunksRef = useRef([]) | |
| const startRecording = useCallback(async () => { | |
| try { | |
| const stream = await navigator.mediaDevices.getUserMedia({ audio: true }) | |
| streamRef.current = stream | |
| const mediaRecorder = new MediaRecorder(stream, { | |
| mimeType: 'audio/webm;codecs=opus' | |
| }) | |
| chunksRef.current = [] | |
| mediaRecorder.ondataavailable = (e) => { | |
| if (e.data.size > 0) { | |
| chunksRef.current.push(e.data) | |
| } | |
| } | |
| mediaRecorder.onstop = async () => { | |
| const audioBlob = new Blob(chunksRef.current, { type: 'audio/webm' }) | |
| const reader = new FileReader() | |
| reader.onloadend = () => { | |
| const base64 = reader.result.split(',')[1] | |
| onRecordingComplete?.(base64) | |
| } | |
| reader.readAsDataURL(audioBlob) | |
| streamRef.current?.getTracks().forEach(t => t.stop()) | |
| } | |
| mediaRecorder.start() | |
| mediaRecorderRef.current = mediaRecorder | |
| setIsRecording(true) | |
| setError(null) | |
| } catch (e) { | |
| console.error('[Mic] Error:', e) | |
| setError('Permita acesso ao microfone') | |
| } | |
| }, [onRecordingComplete]) | |
| const stopRecording = useCallback(() => { | |
| if (mediaRecorderRef.current && isRecording) { | |
| mediaRecorderRef.current.stop() | |
| setIsRecording(false) | |
| } | |
| }, [isRecording]) | |
| return { isRecording, error, startRecording, stopRecording } | |
| } | |