Téléverser les fichiers vers "/"
autres fichiers
This commit is contained in:
82
index.html
Normal file
82
index.html
Normal file
@ -0,0 +1,82 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="fr">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Bubble Bobble JS</title>
|
||||
<style>
|
||||
body {
|
||||
margin: 0;
|
||||
padding: 20px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
background-color: #87CEEB;
|
||||
font-family: Arial, sans-serif;
|
||||
}
|
||||
|
||||
#gameContainer {
|
||||
position: relative;
|
||||
border: 3px solid #333;
|
||||
background-color: #000;
|
||||
}
|
||||
|
||||
#gameCanvas {
|
||||
background-color: #000;
|
||||
}
|
||||
|
||||
#ui {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
width: 800px;
|
||||
margin-top: 10px;
|
||||
color: white;
|
||||
font-size: 20px;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
#controls {
|
||||
margin-top: 20px;
|
||||
color: white;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
button {
|
||||
padding: 10px 20px;
|
||||
font-size: 16px;
|
||||
background-color: #4CAF50;
|
||||
color: white;
|
||||
border: none;
|
||||
border-radius: 5px;
|
||||
cursor: pointer;
|
||||
margin: 5px;
|
||||
}
|
||||
|
||||
button:hover {
|
||||
background-color: #45a049;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<h1 style="color: white;">Bubble Bobble JS</h1>
|
||||
|
||||
<div id="ui">
|
||||
<div>Score: <span id="score">0</span></div>
|
||||
<div>Vies: <span id="lives">3</span></div>
|
||||
<div>Niveau: <span id="level">1</span></div>
|
||||
</div>
|
||||
|
||||
<div id="gameContainer">
|
||||
<canvas id="gameCanvas" width="800" height="600"></canvas>
|
||||
</div>
|
||||
|
||||
<div id="controls">
|
||||
<p>Contrôles: Flèches pour déplacer, ESPACE pour sauter, CTRL pour tirer des bulles</p>
|
||||
<button onclick="startGame()">Nouvelle Partie</button>
|
||||
<button onclick="pauseGame()">Pause</button>
|
||||
</div>
|
||||
|
||||
<script src="game.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
30
install-petitsmodelesvastai.md
Normal file
30
install-petitsmodelesvastai.md
Normal file
@ -0,0 +1,30 @@
|
||||
cat << 'EOF' > /workspace/REINSTALL_CLEAN.md
|
||||
# 📓 IA WORKSPACE : BACKUP COMPLET
|
||||
|
||||
## 🎤 1. SYNTHÈSE VOCALE (PIPER TTS)
|
||||
# Installation Système
|
||||
apt-get update && apt-get install -y espeak-ng-data libespeak-ng1 ffmpeg wget
|
||||
|
||||
# Installation Python (venv)
|
||||
source /venv/main/bin/activate
|
||||
pip install piper-tts flask uvicorn requests
|
||||
|
||||
# Téléchargement Modèles
|
||||
cd /workspace
|
||||
wget -O voice.onnx https://huggingface.co/rhasspy/piper-voices/resolve/main/fr/fr_FR/siwis/low/fr_FR-siwis-low.onnx
|
||||
wget -O voice.onnx.json https://huggingface.co/rhasspy/piper-voices/resolve/main/fr/fr_FR/siwis/low/fr_FR-siwis-low.onnx.json
|
||||
|
||||
## 🎨 2. GÉNÉRATION D'IMAGES (COMFYUI)
|
||||
cd /workspace
|
||||
git clone https://github.com/comfyanonymous/ComfyUI.git
|
||||
cd ComfyUI
|
||||
pip install -r requirements.txt
|
||||
|
||||
# Modèle SDXL
|
||||
cd /workspace/ComfyUI/models/checkpoints/
|
||||
wget https://huggingface.co/stabilityai/stable-diffusion-xl-base-1.0/resolve/main/sd_xl_base_1.0.safetensors
|
||||
|
||||
## 🔗 3. URL OPEN WEBUI
|
||||
- TTS: http://localhost:8000/v1 (Modèle: voice.onnx)
|
||||
- IMAGE: http://localhost:8188
|
||||
EOF
|
||||
3
jetonvastaigitea.txt
Normal file
3
jetonvastaigitea.txt
Normal file
@ -0,0 +1,3 @@
|
||||
980621d1d7f71f71a403b6c31078bf8f3734441c
|
||||
|
||||
https://git.syoul.fr/nicoboy/VASTAI-STUDIO-AUDIO/raw/branch/main/provisioning_script.sh?token=980621d1d7f71f71a403b6c31078bf8f3734441c
|
||||
43
server.py(gradio)
Normal file
43
server.py(gradio)
Normal file
@ -0,0 +1,43 @@
|
||||
import gradio as gr
|
||||
import torch
|
||||
import scipy.io.wavfile
|
||||
import numpy as np
|
||||
import tempfile
|
||||
from audiocraft.models import MusicGen, AudioGen
|
||||
|
||||
print("🔄 Chargement des modèles...")
|
||||
music_model = MusicGen.get_pretrained("facebook/musicgen-small")
|
||||
audio_model = AudioGen.get_pretrained("facebook/audiogen-medium")
|
||||
|
||||
def generate_music(prompt, duration=10):
|
||||
music_model.set_generation_params(duration=duration)
|
||||
wav = music_model.generate([prompt])
|
||||
wav_np = wav[0, 0].cpu().numpy()
|
||||
with tempfile.NamedTemporaryFile(suffix=".wav", delete=False) as f:
|
||||
scipy.io.wavfile.write(f.name, music_model.sample_rate, (wav_np * 32767).astype(np.int16))
|
||||
return f.name
|
||||
|
||||
def generate_sound(prompt, duration=5):
|
||||
audio_model.set_generation_params(duration=duration)
|
||||
wav = audio_model.generate([prompt])
|
||||
wav_np = wav[0, 0].cpu().numpy()
|
||||
with tempfile.NamedTemporaryFile(suffix=".wav", delete=False) as f:
|
||||
scipy.io.wavfile.write(f.name, audio_model.sample_rate, (wav_np * 32767).astype(np.int16))
|
||||
return f.name
|
||||
|
||||
with gr.Blocks(title="🎙️ Studio Audio IA") as demo:
|
||||
gr.Markdown("## 🎙️ Studio Audio IA")
|
||||
with gr.Tab("🎵 Musique"):
|
||||
p1 = gr.Textbox(label="Prompt")
|
||||
d1 = gr.Slider(5, 30, value=10, step=5, label="Durée (s)")
|
||||
b1 = gr.Button("Générer")
|
||||
o1 = gr.Audio(label="Résultat")
|
||||
b1.click(generate_music, inputs=[p1, d1], outputs=o1)
|
||||
with gr.Tab("🔊 Bruitages"):
|
||||
p2 = gr.Textbox(label="Prompt")
|
||||
d2 = gr.Slider(2, 15, value=5, label="Durée (s)")
|
||||
b2 = gr.Button("Générer")
|
||||
o2 = gr.Audio(label="Résultat")
|
||||
b2.click(generate_sound, inputs=[p2, d2], outputs=o2)
|
||||
|
||||
demo.launch(server_name="0.0.0.0", server_port=7860, share=False)
|
||||
52
tts_server.py
Normal file
52
tts_server.py
Normal file
@ -0,0 +1,52 @@
|
||||
import os
|
||||
import subprocess
|
||||
import uuid
|
||||
from flask import Flask, request, send_file, jsonify
|
||||
|
||||
app = Flask(__name__)
|
||||
|
||||
# CONFIGURATION
|
||||
PIPER_MODEL = "/workspace/voice.onnx"
|
||||
OUTPUT_DIR = "/workspace/temp_audio"
|
||||
|
||||
# Créer le dossier temporaire s'il n'existe pas
|
||||
os.makedirs(OUTPUT_DIR, exist_ok=True)
|
||||
|
||||
@app.route('/v1/audio/speech', methods=['POST'])
|
||||
def text_to_speech():
|
||||
data = request.json
|
||||
text = data.get("input")
|
||||
|
||||
if not text:
|
||||
return jsonify({"error": "No input text provided"}), 400
|
||||
|
||||
# Générer un nom de fichier unique
|
||||
file_id = str(uuid.uuid4())
|
||||
output_file = os.path.join(OUTPUT_DIR, f"{file_id}.wav")
|
||||
|
||||
try:
|
||||
# Commande Piper : lit le texte via stdin et écrit dans un fichier
|
||||
# On utilise echo pour envoyer le texte à Piper
|
||||
command = f'echo "{text}" | piper --model {PIPER_MODEL} --output_file {output_file}'
|
||||
|
||||
# Exécution de la commande
|
||||
subprocess.run(command, shell=True, check=True)
|
||||
|
||||
# Envoyer le fichier généré à Open WebUI
|
||||
return send_file(output_file, mimetype="audio/wav")
|
||||
|
||||
except subprocess.CalledProcessError as e:
|
||||
return jsonify({"error": f"Piper failed: {str(e)}"}), 500
|
||||
except Exception as e:
|
||||
return jsonify({"error": str(e)}), 500
|
||||
|
||||
@app.route('/v1/models', methods=['GET'])
|
||||
def list_models():
|
||||
# Nécessaire pour que certaines interfaces valident la connexion
|
||||
return jsonify({
|
||||
"data": [{"id": "voice.onnx", "object": "model", "owned_by": "piper"}]
|
||||
})
|
||||
|
||||
if __name__ == '__main__':
|
||||
# Le serveur écoute sur toutes les interfaces sur le port 8000
|
||||
app.run(host='0.0.0.0', port=8000)
|
||||
Reference in New Issue
Block a user