Repository: stable-diffusion-webui
Issue: [Bug]: index in gradio components calls wrong index
Labels: bug-report

### Is there an existing issue for this?

- [X] I have searched the existing issues and checked the recent builds/commits

### What happened?

Issue with gradio library when trying to generate in txt2img or img2img (only ones tested). Only found on today's build, it worked yesterday.

Traceback (most recent call last):
  File "E:\SD\StableDiffusion2\venv\lib\site-packages\gradio\routes.py", line 337, in run_predict
    output = await app.get_blocks().process_api(
  File "E:\SD\StableDiffusion2\venv\lib\site-packages\gradio\blocks.py", line 1013, in process_api
    inputs = self.preprocess_data(fn_index, inputs, state)
  File "E:\SD\StableDiffusion2\venv\lib\site-packages\gradio\blocks.py", line 911, in preprocess_data
    processed_input.append(block.preprocess(inputs[i]))
  File "E:\SD\StableDiffusion2\venv\lib\site-packages\gradio\components.py", line 1282, in preprocess
    return self.choices.index(x)
ValueError: '' is not in list

or

Traceback (most recent call last):
  File "E:\SD\StableDiffusion2\venv\lib\site-packages\gradio\routes.py", line 337, in run_predict
    output = await app.get_blocks().process_api(
  File "E:\SD\StableDiffusion2\venv\lib\site-packages\gradio\blocks.py", line 1013, in process_api
    inputs = self.preprocess_data(fn_index, inputs, state)
  File "E:\SD\StableDiffusion2\venv\lib\site-packages\gradio\blocks.py", line 911, in preprocess_data
    processed_input.append(block.preprocess(inputs[i]))
  File "E:\SD\StableDiffusion2\venv\lib\site-packages\gradio\components.py", line 1127, in preprocess
    return self.choices.index(x)
ValueError: 2 is not in list

### Steps to reproduce the problem

Click: Generate in either txt2img or img2img.

In img2img I was using SD Upscale on a latent upscale, but it happened on both.

### What should have happened?

it should have generated an image. it errored out.

### Commit where the problem happens

python: 3.10.6  •  torch: 1.12.1+cu113  •  xformers: 0.0.14.dev  •  gradio: 3.16.2  •  commit: 3e0f9a75  •  checkpoint: 13dfc9921f

### What platforms do you use to access the UI ?

Windows

### What browsers do you use to access the UI ?

Google Chrome

### Command Line Arguments

```Shell
set GIT=
set VENV_DIR=
set accelerate="true"
set COMMANDLINE_ARGS= --no-half --xformers
git pull
call webui.bat
```


### List of extensions



LDSR | built-in |  
Lora | built-in |  
ScuNET | built-in |  
SwinIR | built-in |  
prompt-bracket-checker | built-in



### Console logs

```Shell
remote: Enumerating objects: 36, done.
remote: Counting objects: 100% (36/36), done.
remote: Compressing objects: 100% (27/27), done.
remote: Total 36 (delta 15), reused 23 (delta 9), pack-reused 0
Unpacking objects: 100% (36/36), 39.02 KiB | 570.00 KiB/s, done.
From https://github.com/AUTOMATIC1111/stable-diffusion-webui
   3e0f9a75..ea9bd9fc  master     -> origin/master
Updating 3e0f9a75..ea9bd9fc
Fast-forward
 javascript/hints.js                  |  4 ++--
 modules/images.py                    |  8 +++++---
 modules/modelloader.py               |  3 +++
 modules/sd_disable_initialization.py | 17 ++++++++++-------
 modules/sd_models.py                 |  6 +++++-
 modules/ui_extra_networks.py         |  2 +-
 scripts/prompt_matrix.py             | 24 +++++++++---------------
 scripts/xyz_grid.py                  | 25 ++++++++++++++++---------
 8 files changed, 51 insertions(+), 38 deletions(-)
venv "E:\SD\StableDiffusion2\venv\Scripts\Python.exe"
Python 3.10.6 (tags/v3.10.6:9c7b4bd, Aug  1 2022, 21:53:49) [MSC v.1932 64 bit (AMD64)]
Commit hash: ea9bd9fc7409109adcd61b897abc2c8881161256
Installing requirements for Web UI
Launching Web UI with arguments: --no-half --xformers
==============================================================================
You are running torch 1.12.1+cu113.
The program is tested to work with torch 1.13.1.
To reinstall the desired version, run with commandline flag --reinstall-torch.
Beware that this will cause a lot of large files to be downloaded, as well as
there are reports of issues with training tab on the latest version.

Use --skip-version-check commandline argument to disable this check.
==============================================================================
=================================================================================
You are running xformers 0.0.14.dev.
The program is tested to work with xformers 0.0.16rc425.
To reinstall the desired version, run with commandline flag --reinstall-xformers.

Use --skip-version-check commandline argument to disable this check.
=================================================================================
Loading weights [13dfc9921f] from E:\SD\StableDiffusion2\models\Stable-diffusion\dreamshaper_332BakedVaeClipFix.safetensors
Creating model from config: E:\SD\StableDiffusion2\configs\v1-inference.yaml
LatentDiffusion: Running in eps-prediction mode
DiffusionWrapper has 859.52 M params.
Applying xformers cross attention optimization.
Textual inversion embeddings loaded(0):
Model loaded in 14.4s (load weights from disk: 0.2s, create model: 0.5s, apply weights to model: 11.0s, move model to device: 1.2s, load textual inversion embeddings: 1.4s).

Thanks for being a Gradio user! If you have questions or feedback, please join our Discord server and chat with us: https://discord.gg/feTf9x3ZSB
Running on local URL:  http://127.0.0.1:7860

To create a public link, set `share=True` in `launch()`.
Traceback (most recent call last):
  File "E:\SD\StableDiffusion2\venv\lib\site-packages\gradio\routes.py", line 337, in run_predict
    output = await app.get_blocks().process_api(
  File "E:\SD\StableDiffusion2\venv\lib\site-packages\gradio\blocks.py", line 1013, in process_api
    inputs = self.preprocess_data(fn_index, inputs, state)
  File "E:\SD\StableDiffusion2\venv\lib\site-packages\gradio\blocks.py", line 911, in preprocess_data
    processed_input.append(block.preprocess(inputs[i]))
  File "E:\SD\StableDiffusion2\venv\lib\site-packages\gradio\components.py", line 1282, in preprocess
    return self.choices.index(x)
ValueError: '' is not in list
Traceback (most recent call last):
  File "E:\SD\StableDiffusion2\venv\lib\site-packages\gradio\routes.py", line 337, in run_predict
    output = await app.get_blocks().process_api(
  File "E:\SD\StableDiffusion2\venv\lib\site-packages\gradio\blocks.py", line 1013, in process_api
    inputs = self.preprocess_data(fn_index, inputs, state)
  File "E:\SD\StableDiffusion2\venv\lib\site-packages\gradio\blocks.py", line 911, in preprocess_data
    processed_input.append(block.preprocess(inputs[i]))
  File "E:\SD\StableDiffusion2\venv\lib\site-packages\gradio\components.py", line 1282, in preprocess
    return self.choices.index(x)
ValueError: '' is not in list
Traceback (most recent call last):
  File "E:\SD\StableDiffusion2\venv\lib\site-packages\gradio\routes.py", line 337, in run_predict
    output = await app.get_blocks().process_api(
  File "E:\SD\StableDiffusion2\venv\lib\site-packages\gradio\blocks.py", line 1013, in process_api
    inputs = self.preprocess_data(fn_index, inputs, state)
  File "E:\SD\StableDiffusion2\venv\lib\site-packages\gradio\blocks.py", line 911, in preprocess_data
    processed_input.append(block.preprocess(inputs[i]))
  File "E:\SD\StableDiffusion2\venv\lib\site-packages\gradio\components.py", line 1127, in preprocess
    return self.choices.index(x)
ValueError: 2 is not in list
```


### Additional information

_No response_