Add ComfyUI models documentation and download script
- Complete MODELS.md with detailed model descriptions - Interactive download script for 5+ specialized SDXL models - Updated README with model selection guide - Fix docker-compose volumes path (/root/ComfyUI) - API workflows for OpenWebUI integration Models documented: - RealVisXL (portraits) - Juggernaut XL (versatile) - DreamShaper (art/fantasy) - SDXL Lightning (fast) - Proteus (realism)
This commit is contained in:
@@ -0,0 +1,56 @@
|
||||
#!/usr/bin/env python3
|
||||
"""
|
||||
Proxy OpenAI API pour whisper-asr-webservice
|
||||
Traduit les requêtes OpenAI (/v1/audio/transcriptions) vers /asr
|
||||
"""
|
||||
|
||||
from flask import Flask, request, jsonify
|
||||
import requests
|
||||
import tempfile
|
||||
import os
|
||||
|
||||
app = Flask(__name__)
|
||||
WHISPER_URL = "http://localhost:9000/asr" # URL interne du container
|
||||
|
||||
@app.route('/health', methods=['GET'])
|
||||
def health():
|
||||
return jsonify({"status": "healthy"})
|
||||
|
||||
@app.route('/v1/audio/transcriptions', methods=['POST'])
|
||||
def transcribe():
|
||||
try:
|
||||
# Récupérer le fichier audio
|
||||
if 'file' not in request.files:
|
||||
return jsonify({"error": "No file provided"}), 400
|
||||
|
||||
audio_file = request.files['file']
|
||||
language = request.form.get('language', 'fr')
|
||||
|
||||
# Sauvegarder temporairement
|
||||
with tempfile.NamedTemporaryFile(delete=False, suffix='.mp3') as tmp:
|
||||
audio_file.save(tmp.name)
|
||||
|
||||
# Appeler whisper-asr-webservice
|
||||
with open(tmp.name, 'rb') as f:
|
||||
response = requests.post(
|
||||
WHISPER_URL,
|
||||
files={'audio_file': f},
|
||||
params={'language': language, 'output': 'json'}
|
||||
)
|
||||
|
||||
os.unlink(tmp.name)
|
||||
|
||||
if response.status_code == 200:
|
||||
result = response.json()
|
||||
# Format OpenAI : { "text": "..." }
|
||||
return jsonify({"text": result.get('text', '')})
|
||||
else:
|
||||
return jsonify({"error": "Transcription failed"}), 500
|
||||
|
||||
except Exception as e:
|
||||
return jsonify({"error": str(e)}), 500
|
||||
|
||||
if __name__ == '__main__':
|
||||
print("🎙️ Proxy STT démarré sur http://0.0.0.0:8201")
|
||||
print(" Redirige vers whisper-asr-webservice sur http://localhost:9000/asr")
|
||||
app.run(host='0.0.0.0', port=8201, threaded=True)
|
||||
Reference in New Issue
Block a user