File size: 743 Bytes
77c5c0a 6f8cfc5 cbeef03 6f8cfc5 77c5c0a b65749b f21f58b 6f8cfc5 67bab9f 18415cb 6f8cfc5 67bab9f 6f8cfc5 67bab9f | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | 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()
|