import gradio as gr import os # If 'share_btn.py' is a custom module, ensure it's available; otherwise, comment out or remove these imports # from share_btn import community_icon_html, loading_icon_html, share_js # Load interfaces from Hugging Face Spaces text_gen = gr.Interface.load(name="spaces/Gustavosta/MagicPrompt-Stable-Diffusion") stable_diffusion = gr.Interface.load(name="spaces/runwayml/stable-diffusion-v1-5") def get_images(prompt): # Call the stable_diffusion interface with the prompt sd_output = stable_diffusion(prompt) # Return the output images and update the visibility of icons return sd_output, gr.update(visible=True), gr.update(visible=True) def get_prompts(prompt_text): # Generate expanded prompts using the text_gen interface return text_gen(prompt_text) css = ''' /* Your CSS styles remain unchanged */ .animate-spin { animation: spin 1s linear infinite; } /* ... rest of the CSS ... */ ''' with gr.Blocks(css=css) as demo: gr.HTML("""
🏭 Prompt Refinery generates variations of your prompt using MagicPrompt and Stable Diffusion