import gradio as gr from huggingface_hub import InferenceClient # On utilise l'API externe, c'est beaucoup plus léger ! client = InferenceClient("prompthero/openjourney") def king_vision_engine(text_input): if not text_input: return None try: # L'IA génère l'image à distance image = client.text_to_image(text_input) return image except Exception as e: return None with gr.Blocks(theme=gr.themes.Soft()) as demo: gr.Markdown("# KINGCLIP AI - Mode Rapide") with gr.Row(): txt = gr.Textbox(label="Ta description") img = gr.Image(label="Résultat") btn = gr.Button("Générer ✨") btn.click(fn=king_vision_engine, inputs=txt, outputs=img) demo.launch()