Compare commits
25 Commits
main
...
2298fb53b8
| Author | SHA1 | Date | |
|---|---|---|---|
| 2298fb53b8 | |||
| e5c29e5b46 | |||
| 5e2ace4829 | |||
| 968e4520bc | |||
| 74db170b38 | |||
| 904aa51bc4 | |||
| 14853463de | |||
| e80b0af5ab | |||
| 2c28364bf8 | |||
| 45f09ae7ff | |||
| c710a007f8 | |||
| 06973e6d94 | |||
| 4845a6ec4a | |||
| fdc0babb7e | |||
| 5d064b9192 | |||
| dd0481d0a8 | |||
| 2a36213b25 | |||
| 71304cbc1e | |||
| 9fa2420691 | |||
| f33db26118 | |||
| 7ab5e36805 | |||
| 6dac601784 | |||
| fe25137539 | |||
| 7a879c81ed | |||
| 043e491a77 |
@ -1,8 +0,0 @@
|
||||
# Clé secrète Open WebUI (générer avec: openssl rand -hex 32)
|
||||
WEBUI_SECRET_KEY=your_secret_key_here
|
||||
|
||||
# IP publique de ta VM Vast.ai (change à chaque nouvelle instance)
|
||||
WEBUI_URL=http://YOUR_VAST_AI_IP
|
||||
|
||||
# Token du tunnel Cloudflare
|
||||
CF_TUNNEL_TOKEN=your_cloudflare_tunnel_token
|
||||
@ -16,27 +16,14 @@ services:
|
||||
condition: service_started
|
||||
restart: always
|
||||
|
||||
# --- LE TUNNEL HTTPS ---
|
||||
cloudflared:
|
||||
image: cloudflare/cloudflared:latest
|
||||
container_name: studio-cloudflared
|
||||
command: tunnel --no-autoupdate run --token ${CF_TUNNEL_TOKEN}
|
||||
environment:
|
||||
- CF_TUNNEL_TOKEN=${CF_TUNNEL_TOKEN}
|
||||
networks:
|
||||
- studio-net
|
||||
depends_on:
|
||||
- gateway
|
||||
restart: always
|
||||
|
||||
# --- L'INTERFACE (Open WebUI) ---
|
||||
open-webui:
|
||||
image: ghcr.io/open-webui/open-webui:main
|
||||
container_name: open-webui
|
||||
environment:
|
||||
- OLLAMA_BASE_URL=http://ollama:11434
|
||||
- WEBUI_SECRET_KEY=${WEBUI_SECRET_KEY}
|
||||
- WEBUI_URL=${WEBUI_URL}
|
||||
- WEBUI_SECRET_KEY=${WEBUI_SECRET_KEY:-supersecretkey}
|
||||
- WEBUI_URL=http://93.108.34.236
|
||||
- ENABLE_WEBSOCKETS=True
|
||||
volumes:
|
||||
- webui_data:/app/backend/data
|
||||
|
||||
@ -1,20 +1,31 @@
|
||||
server {
|
||||
listen 80;
|
||||
|
||||
# --- TRANSCRIPTION AUDIO (STT) ---
|
||||
# Doit être AVANT location / pour avoir la priorité
|
||||
location /api/v1/audio/transcriptions {
|
||||
proxy_pass http://audio-api:7860/v1/audio/transcriptions;
|
||||
# Interface principale & Flux Ollama
|
||||
location / {
|
||||
proxy_pass http://open-webui:8080;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
|
||||
# --- AJOUT INDISPENSABLE POUR LES WEBSOCKETS ---
|
||||
proxy_http_version 1.1; ## Requis
|
||||
proxy_set_header Upgrade $http_upgrade; ## Requis
|
||||
proxy_set_header Connection "upgrade"; ## Requis
|
||||
# -----------------------------------------------
|
||||
|
||||
# DESACTIVATION TOTALE DU CACHE ET DU BUFFER
|
||||
proxy_buffering off;
|
||||
proxy_cache off;
|
||||
chunked_transfer_encoding on;
|
||||
|
||||
# Temps d'attente rallongé pour les gros modèles
|
||||
proxy_read_timeout 600s;
|
||||
proxy_send_timeout 600s;
|
||||
client_max_body_size 25M;
|
||||
}
|
||||
|
||||
# --- API AUDIO (accès direct Gradio/FastAPI) ---
|
||||
# API Audio
|
||||
location /audio/ {
|
||||
proxy_pass http://audio-api:7860/;
|
||||
proxy_http_version 1.1;
|
||||
@ -23,30 +34,5 @@ server {
|
||||
proxy_set_header Host $host;
|
||||
proxy_buffering off;
|
||||
proxy_read_timeout 600s;
|
||||
client_max_body_size 25M;
|
||||
}
|
||||
|
||||
# --- INTERFACE PRINCIPALE & FLUX OLLAMA ---
|
||||
location / {
|
||||
proxy_pass http://open-webui:8080;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
|
||||
# INDISPENSABLE POUR LES WEBSOCKETS
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection "upgrade";
|
||||
|
||||
# DÉSACTIVATION TOTALE DU CACHE ET DU BUFFER
|
||||
proxy_buffering off;
|
||||
proxy_cache off;
|
||||
chunked_transfer_encoding on;
|
||||
|
||||
# Temps d'attente rallongé pour les gros modèles
|
||||
proxy_read_timeout 600s;
|
||||
proxy_send_timeout 600s;
|
||||
client_max_body_size 25M;
|
||||
}
|
||||
}
|
||||
@ -1,35 +1,19 @@
|
||||
from fastapi import FastAPI, UploadFile, File, HTTPException
|
||||
from faster_whisper import WhisperModel
|
||||
import io
|
||||
import gradio as gr
|
||||
import time
|
||||
|
||||
app = FastAPI()
|
||||
def generate_music(prompt, duration):
|
||||
print(f"🎵 Génération demandée : {prompt} pour {duration} secondes")
|
||||
# Simule un temps de calcul
|
||||
time.sleep(2)
|
||||
return "Dummy audio generated !"
|
||||
|
||||
# Chargement du modèle sur ton GPU RTX 4060 Ti
|
||||
# On utilise "cuda" et "float16" pour la vitesse maximale
|
||||
model = WhisperModel("base", device="cuda", compute_type="float16")
|
||||
|
||||
@app.get("/v1/models")
|
||||
async def get_models():
|
||||
# Indispensable pour qu'Open WebUI voie le modèle dans la liste
|
||||
return {"data": [{"id": "whisper-1"}]}
|
||||
|
||||
@app.post("/v1/audio/transcriptions")
|
||||
async def transcribe(file: UploadFile = File(...)):
|
||||
try:
|
||||
# On lit le fichier envoyé par le micro
|
||||
audio_data = await file.read()
|
||||
audio_file = io.BytesIO(audio_data)
|
||||
|
||||
# Transcription ultra-rapide avec ton GPU
|
||||
segments, _ = model.transcribe(audio_file, beam_size=5)
|
||||
text = " ".join([segment.text for segment in segments])
|
||||
|
||||
return {"text": text}
|
||||
except Exception as e:
|
||||
print(f"Erreur transcription: {e}")
|
||||
raise HTTPException(status_code=500, detail=str(e))
|
||||
# Interface pour Open WebUI
|
||||
demo = gr.Interface(
|
||||
fn=generate_music,
|
||||
inputs=["text", "number"],
|
||||
outputs="text",
|
||||
title="ACE-Step Audio API"
|
||||
)
|
||||
|
||||
if __name__ == "__main__":
|
||||
import uvicorn
|
||||
# On lance sur le port 7860 comme prévu dans ton Docker-compose
|
||||
uvicorn.run(app, host="0.0.0.0", port=7860)
|
||||
demo.launch(server_name="0.0.0.0", server_port=7860)
|
||||
Reference in New Issue
Block a user