Download app.py from Boaz009/KINGCLIP: direct link, hf CLI and curl.
- Browser
- Download file 743 Bytes
-
https://huggingface.co/spaces/Boaz009/KINGCLIP/resolve/main/app.py
- Command line
-
hf download hf://spaces/Boaz009/KINGCLIP/app.py
-
curl -L -o app.py https://huggingface.co/spaces/Boaz009/KINGCLIP/resolve/main/app.py
743 Bytes
| 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() | |