run_n_times.py (original) (raw)
Star (12) You must be signed in to star a gist
Fork (4) You must be signed in to fork a gist
Select an option
Clone this repository at <script src="https://gist.github.com/camenduru/9ec5f8141db9902e375967e93250860f.js"></script>
- Save camenduru/9ec5f8141db9902e375967e93250860f to your computer and use it in GitHub Desktop.
Select an option
Clone this repository at <script src="https://gist.github.com/camenduru/9ec5f8141db9902e375967e93250860f.js"></script>
Save camenduru/9ec5f8141db9902e375967e93250860f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
[ Show hidden characters]({{ revealButtonHref }})
| import math |
|---|
| import os |
| import sys |
| import traceback |
| import modules.scripts as scripts |
| import gradio as gr |
| from modules.processing import Processed, process_images |
| class Script(scripts.Script): |
| def title(self): |
| return "Run n times" |
| def ui(self, is_img2img): |
| n = gr.Textbox(label="n") |
| return [n] |
| def run(self, p, n): |
| for x in range(int(n)): |
| p.seed = -1 |
| proc = process_images(p) |
| image = proc.images |
| return Processed(p, image, p.seed, proc.info) |