--- title: Structured Prompted Gif emoji: 🖼 colorFrom: purple colorTo: red sdk: gradio sdk_version: 4.26.0 app_file: app.py pinned: false license: mit short_description: 'Generate GIF with structured prompts in recent HF paper' --- # Structured Prompt GIF Generator This application generates GIFs from text prompts using the Hotshot-XL model. It is built with Gradio and hosted on Hugging Face Spaces. ## How to Use 1. **Enter a Prompt**: You can use the default prompt template or enter your own custom prompt. 2. **Generate GIF**: Click on the button to generate a GIF based on your prompt. 3. **Download GIF**: Once generated, you can download and view the GIF. ## Default Prompt Template Note: Not every part of the template needs to be used, but they should be formatted in order presented, skipping any you don't use, to retain prompt effectiveness (see other examples below) { subject: action: setting: style: duration: } ## My Example: {subject, action, setting, style, duration} Create a GIF with the subject being a 'Technical Difficulties' television program interruption. The action should show colored glitchy and typical 'technical difficulties' cable interruptions, (using|with) demonic symbols glitching out along with the colors of the usual 'tech difficulties' broadcasts. The setting should be (an older|a vintage) tv cable broadcast signal interruption with rainbow colors and glitchy effects. The style should be a realistic cable interruption interlaced with (demonic imagery|dark symbols) glitching out along with the typical color page of interruption in TV cable connection issues. The GIF should last for 1 second. ## Custom Prompts - Should always include at least "subject", "action", and "duration". "style" and "setting" are not required but may create better results You can customize the prompt to generate different types of GIFs. Simply enter your text in the provided textbox and click the button to generate a GIF. ### Example Prompts 1. **Cat Jumping Over a Fence**: {"subject, action, style, duration"} Create a GIF of a cat jumping over a fence in a sunny backyard. The style should be realistic. The GIF should last for 2 seconds. 2. **Rocket Launch**: {"subject, action, setting, style, duration"} Create a GIF of a rocket. The Rocket should be launching into space. The scene should show the rocket taking off from the launchpad with smoke and fire. The style should be cinematic. The GIF should last for 3 seconds. ## Technical Details This application uses the `hotshotco/Hotshot-XL` model from Hugging Face. The prompt is processed to select the first option from regex choices before generating the GIF. ## Dependencies - `gradio` - `transformers` These dependencies are managed automatically by Hugging Face Spaces. ## Contributing If you have any suggestions or improvements, feel free to open an issue or submit a pull request. ## License This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.