We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
[Bug]: loopback.py match-case traceback on Google Colab
### Is there an existing issue for this?

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

### What happened?

what happened? I don't really know.
all of a sudden I'm getting tracebacks and the WebUI won't load properly, making it unuseable.
![image](https://user-images.githubusercontent.com/38461122/227729893-f922a4af-b29c-4908-ba16-e26998e10f87.png)
![image](https://user-images.githubusercontent.com/38461122/227729556-6bcbedd3-c702-4223-9928-811169447a9e.png)


### Steps to reproduce the problem

1. open [this colab notebook](https://colab.research.google.com/github/shirooo39/MiXLab/blob/master/MiXLab.ipynb#scrollTo=6_Sxep-D4HEf)
2. change the runtime type to GPU
3. run the cell: Initialize
4. urn the cell: Download Diffusion Models
5. run the cell: Start WebUI
6. wait for error

### What should have happened?

it shouldn't've thrown those tracebacks and the WebUI loads properly.

### Commit where the problem happens

91ae48fd

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

Other/Cloud

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

Mozilla Firefox

### Command Line Arguments

```Shell
!COMMANDLINE_ARGS="--share --api --gradio-debug --gradio-queue --medvram --xformers --disable-safe-unpickle --enable-insecure-extension-access --no-half-vae --no-download-sd-model --disable-console-progressbars" REQS_FILE="requirements.txt" python launch.py
```


### List of extensions

No

### Console logs

```Shell
https://rentry.org/a1111webui91ae48fd
```


### Additional information

I'm the author of MiXLab notebook and I wrote my own simple Colab implementation of your WebUI.
it was working fine last night as of 2023-03-24, around 11 PM UTC+07:00, I was able to launch the WebUI without getting any tracebacks.

I was able to generate images at that time (the screenshot below is an image I generated on Colab and downloaded locally)
![image](https://user-images.githubusercontent.com/38461122/227730668-18f6a70e-4f62-403d-8232-fe8be1f80d48.png)

I'm constantly making changes to my notebook BUT I did not touch to the "Initialize" and "Start WebUI" cells.  
I only touch to the model downloader cells.  
so I don't think the issue is within my notebook, but I haven't tried TheLastBen's notebook either...

Colab still uses Python 3.7 and the match-case used in the loopback.py was only introduced in Python 3.10 and newer.  
that could be the reason why Colab is throwing out tracebacks.

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `scripts/loopback.py`
Content:
```
1 import math
2 
3 import gradio as gr
4 import modules.scripts as scripts
5 from modules import deepbooru, images, processing, shared
6 from modules.processing import Processed
7 from modules.shared import opts, state
8 
9 
10 class Script(scripts.Script):
11     def title(self):
12         return "Loopback"
13 
14     def show(self, is_img2img):
15         return is_img2img
16 
17     def ui(self, is_img2img):        
18         loops = gr.Slider(minimum=1, maximum=32, step=1, label='Loops', value=4, elem_id=self.elem_id("loops"))
19         final_denoising_strength = gr.Slider(minimum=0, maximum=1, step=0.01, label='Final denoising strength', value=0.5, elem_id=self.elem_id("final_denoising_strength"))
20         denoising_curve = gr.Dropdown(label="Denoising strength curve", choices=["Aggressive", "Linear", "Lazy"], value="Linear")
21         append_interrogation = gr.Dropdown(label="Append interrogated prompt at each iteration", choices=["None", "CLIP", "DeepBooru"], value="None")
22 
23         return [loops, final_denoising_strength, denoising_curve, append_interrogation]
24 
25     def run(self, p, loops, final_denoising_strength, denoising_curve, append_interrogation):
26         processing.fix_seed(p)
27         batch_count = p.n_iter
28         p.extra_generation_params = {
29             "Final denoising strength": final_denoising_strength,
30             "Denoising curve": denoising_curve
31         }
32 
33         p.batch_size = 1
34         p.n_iter = 1
35 
36         info = None
37         initial_seed = None
38         initial_info = None
39         initial_denoising_strength = p.denoising_strength
40 
41         grids = []
42         all_images = []
43         original_init_image = p.init_images
44         original_prompt = p.prompt
45         original_inpainting_fill = p.inpainting_fill
46         state.job_count = loops * batch_count
47 
48         initial_color_corrections = [processing.setup_color_correction(p.init_images[0])]
49 
50         def calculate_denoising_strength(loop):
51             strength = initial_denoising_strength
52 
53             if loops == 1:
54                 return strength
55 
56             progress = loop / (loops - 1)
57             match denoising_curve:
58                 case "Aggressive":
59                     strength = math.sin((progress) * math.pi * 0.5)
60 
61                 case "Lazy":
62                     strength = 1 - math.cos((progress) * math.pi * 0.5)
63 
64                 case _:
65                     strength = progress
66 
67             change = (final_denoising_strength - initial_denoising_strength) * strength
68             return initial_denoising_strength + change
69 
70         history = []
71 
72         for n in range(batch_count):
73             # Reset to original init image at the start of each batch
74             p.init_images = original_init_image
75 
76             # Reset to original denoising strength
77             p.denoising_strength = initial_denoising_strength
78 
79             last_image = None
80 
81             for i in range(loops):
82                 p.n_iter = 1
83                 p.batch_size = 1
84                 p.do_not_save_grid = True
85 
86                 if opts.img2img_color_correction:
87                     p.color_corrections = initial_color_corrections
88 
89                 if append_interrogation != "None":
90                     p.prompt = original_prompt + ", " if original_prompt != "" else ""
91                     if append_interrogation == "CLIP":
92                         p.prompt += shared.interrogator.interrogate(p.init_images[0])
93                     elif append_interrogation == "DeepBooru":
94                         p.prompt += deepbooru.model.tag(p.init_images[0])
95 
96                 state.job = f"Iteration {i + 1}/{loops}, batch {n + 1}/{batch_count}"
97 
98                 processed = processing.process_images(p)
99 
100                 # Generation cancelled.
101                 if state.interrupted:
102                     break
103 
104                 if initial_seed is None:
105                     initial_seed = processed.seed
106                     initial_info = processed.info
107 
108                 p.seed = processed.seed + 1
109                 p.denoising_strength = calculate_denoising_strength(i + 1)
110                 
111                 if state.skipped:
112                     break
113 
114                 last_image = processed.images[0]
115                 p.init_images = [last_image]
116                 p.inpainting_fill = 1 # Set "masked content" to "original" for next loop.
117 
118                 if batch_count == 1:
119                     history.append(last_image)
120                     all_images.append(last_image)
121 
122             if batch_count > 1 and not state.skipped and not state.interrupted:
123                 history.append(last_image)
124                 all_images.append(last_image)
125 
126             p.inpainting_fill = original_inpainting_fill
127                 
128             if state.interrupted:
129                     break
130 
131         if len(history) > 1:
132             grid = images.image_grid(history, rows=1)
133             if opts.grid_save:
134                 images.save_image(grid, p.outpath_grids, "grid", initial_seed, p.prompt, opts.grid_format, info=info, short_filename=not opts.grid_extended_filename, grid=True, p=p)
135 
136             if opts.return_grid:
137                 grids.append(grid)
138                 
139         all_images = grids + all_images
140 
141         processed = Processed(p, all_images, initial_seed, initial_info)
142 
143         return processed
144
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/scripts/loopback.py b/scripts/loopback.py
--- a/scripts/loopback.py
+++ b/scripts/loopback.py
@@ -54,15 +54,12 @@
                 return strength
 
             progress = loop / (loops - 1)
-            match denoising_curve:
-                case "Aggressive":
-                    strength = math.sin((progress) * math.pi * 0.5)
-
-                case "Lazy":
-                    strength = 1 - math.cos((progress) * math.pi * 0.5)
-
-                case _:
-                    strength = progress
+            if denoising_curve == "Aggressive":
+                strength = math.sin((progress) * math.pi * 0.5)
+            elif denoising_curve == "Lazy":
+                strength = 1 - math.cos((progress) * math.pi * 0.5)
+            else:
+                strength = progress
 
             change = (final_denoising_strength - initial_denoising_strength) * strength
             return initial_denoising_strength + change

{"golden_diff": "diff --git a/scripts/loopback.py b/scripts/loopback.py\n--- a/scripts/loopback.py\n+++ b/scripts/loopback.py\n@@ -54,15 +54,12 @@\n                 return strength\r\n \r\n             progress = loop / (loops - 1)\r\n-            match denoising_curve:\r\n-                case \"Aggressive\":\r\n-                    strength = math.sin((progress) * math.pi * 0.5)\r\n-\r\n-                case \"Lazy\":\r\n-                    strength = 1 - math.cos((progress) * math.pi * 0.5)\r\n-\r\n-                case _:\r\n-                    strength = progress\r\n+            if denoising_curve == \"Aggressive\":\r\n+                strength = math.sin((progress) * math.pi * 0.5)\r\n+            elif denoising_curve == \"Lazy\":\r\n+                strength = 1 - math.cos((progress) * math.pi * 0.5)\r\n+            else:\r\n+                strength = progress\r\n \r\n             change = (final_denoising_strength - initial_denoising_strength) * strength\r\n             return initial_denoising_strength + change\n", "issue": "[Bug]: loopback.py match-case traceback on Google Colab\n### Is there an existing issue for this?\n\n- [X] I have searched the existing issues and checked the recent builds/commits\n\n### What happened?\n\nwhat happened? I don't really know.\r\nall of a sudden I'm getting tracebacks and the WebUI won't load properly, making it unuseable.\r\n![image](https://user-images.githubusercontent.com/38461122/227729893-f922a4af-b29c-4908-ba16-e26998e10f87.png)\r\n![image](https://user-images.githubusercontent.com/38461122/227729556-6bcbedd3-c702-4223-9928-811169447a9e.png)\r\n\n\n### Steps to reproduce the problem\n\n1. open [this colab notebook](https://colab.research.google.com/github/shirooo39/MiXLab/blob/master/MiXLab.ipynb#scrollTo=6_Sxep-D4HEf)\r\n2. change the runtime type to GPU\r\n3. run the cell: Initialize\r\n4. urn the cell: Download Diffusion Models\r\n5. run the cell: Start WebUI\r\n6. wait for error\n\n### What should have happened?\n\nit shouldn't've thrown those tracebacks and the WebUI loads properly.\n\n### Commit where the problem happens\n\n91ae48fd\n\n### What platforms do you use to access the UI ?\n\nOther/Cloud\n\n### What browsers do you use to access the UI ?\n\nMozilla Firefox\n\n### Command Line Arguments\n\n```Shell\n!COMMANDLINE_ARGS=\"--share --api --gradio-debug --gradio-queue --medvram --xformers --disable-safe-unpickle --enable-insecure-extension-access --no-half-vae --no-download-sd-model --disable-console-progressbars\" REQS_FILE=\"requirements.txt\" python launch.py\n```\n\n\n### List of extensions\n\nNo\n\n### Console logs\n\n```Shell\nhttps://rentry.org/a1111webui91ae48fd\n```\n\n\n### Additional information\n\nI'm the author of MiXLab notebook and I wrote my own simple Colab implementation of your WebUI.\r\nit was working fine last night as of 2023-03-24, around 11 PM UTC+07:00, I was able to launch the WebUI without getting any tracebacks.\r\n\r\nI was able to generate images at that time (the screenshot below is an image I generated on Colab and downloaded locally)\r\n![image](https://user-images.githubusercontent.com/38461122/227730668-18f6a70e-4f62-403d-8232-fe8be1f80d48.png)\r\n\r\nI'm constantly making changes to my notebook BUT I did not touch to the \"Initialize\" and \"Start WebUI\" cells.  \r\nI only touch to the model downloader cells.  \r\nso I don't think the issue is within my notebook, but I haven't tried TheLastBen's notebook either...\r\n\r\nColab still uses Python 3.7 and the match-case used in the loopback.py was only introduced in Python 3.10 and newer.  \r\nthat could be the reason why Colab is throwing out tracebacks.\n", "before_files": [{"content": "import math\r\n\r\nimport gradio as gr\r\nimport modules.scripts as scripts\r\nfrom modules import deepbooru, images, processing, shared\r\nfrom modules.processing import Processed\r\nfrom modules.shared import opts, state\r\n\r\n\r\nclass Script(scripts.Script):\r\n    def title(self):\r\n        return \"Loopback\"\r\n\r\n    def show(self, is_img2img):\r\n        return is_img2img\r\n\r\n    def ui(self, is_img2img):        \r\n        loops = gr.Slider(minimum=1, maximum=32, step=1, label='Loops', value=4, elem_id=self.elem_id(\"loops\"))\r\n        final_denoising_strength = gr.Slider(minimum=0, maximum=1, step=0.01, label='Final denoising strength', value=0.5, elem_id=self.elem_id(\"final_denoising_strength\"))\r\n        denoising_curve = gr.Dropdown(label=\"Denoising strength curve\", choices=[\"Aggressive\", \"Linear\", \"Lazy\"], value=\"Linear\")\r\n        append_interrogation = gr.Dropdown(label=\"Append interrogated prompt at each iteration\", choices=[\"None\", \"CLIP\", \"DeepBooru\"], value=\"None\")\r\n\r\n        return [loops, final_denoising_strength, denoising_curve, append_interrogation]\r\n\r\n    def run(self, p, loops, final_denoising_strength, denoising_curve, append_interrogation):\r\n        processing.fix_seed(p)\r\n        batch_count = p.n_iter\r\n        p.extra_generation_params = {\r\n            \"Final denoising strength\": final_denoising_strength,\r\n            \"Denoising curve\": denoising_curve\r\n        }\r\n\r\n        p.batch_size = 1\r\n        p.n_iter = 1\r\n\r\n        info = None\r\n        initial_seed = None\r\n        initial_info = None\r\n        initial_denoising_strength = p.denoising_strength\r\n\r\n        grids = []\r\n        all_images = []\r\n        original_init_image = p.init_images\r\n        original_prompt = p.prompt\r\n        original_inpainting_fill = p.inpainting_fill\r\n        state.job_count = loops * batch_count\r\n\r\n        initial_color_corrections = [processing.setup_color_correction(p.init_images[0])]\r\n\r\n        def calculate_denoising_strength(loop):\r\n            strength = initial_denoising_strength\r\n\r\n            if loops == 1:\r\n                return strength\r\n\r\n            progress = loop / (loops - 1)\r\n            match denoising_curve:\r\n                case \"Aggressive\":\r\n                    strength = math.sin((progress) * math.pi * 0.5)\r\n\r\n                case \"Lazy\":\r\n                    strength = 1 - math.cos((progress) * math.pi * 0.5)\r\n\r\n                case _:\r\n                    strength = progress\r\n\r\n            change = (final_denoising_strength - initial_denoising_strength) * strength\r\n            return initial_denoising_strength + change\r\n\r\n        history = []\r\n\r\n        for n in range(batch_count):\r\n            # Reset to original init image at the start of each batch\r\n            p.init_images = original_init_image\r\n\r\n            # Reset to original denoising strength\r\n            p.denoising_strength = initial_denoising_strength\r\n\r\n            last_image = None\r\n\r\n            for i in range(loops):\r\n                p.n_iter = 1\r\n                p.batch_size = 1\r\n                p.do_not_save_grid = True\r\n\r\n                if opts.img2img_color_correction:\r\n                    p.color_corrections = initial_color_corrections\r\n\r\n                if append_interrogation != \"None\":\r\n                    p.prompt = original_prompt + \", \" if original_prompt != \"\" else \"\"\r\n                    if append_interrogation == \"CLIP\":\r\n                        p.prompt += shared.interrogator.interrogate(p.init_images[0])\r\n                    elif append_interrogation == \"DeepBooru\":\r\n                        p.prompt += deepbooru.model.tag(p.init_images[0])\r\n\r\n                state.job = f\"Iteration {i + 1}/{loops}, batch {n + 1}/{batch_count}\"\r\n\r\n                processed = processing.process_images(p)\r\n\r\n                # Generation cancelled.\r\n                if state.interrupted:\r\n                    break\r\n\r\n                if initial_seed is None:\r\n                    initial_seed = processed.seed\r\n                    initial_info = processed.info\r\n\r\n                p.seed = processed.seed + 1\r\n                p.denoising_strength = calculate_denoising_strength(i + 1)\r\n                \r\n                if state.skipped:\r\n                    break\r\n\r\n                last_image = processed.images[0]\r\n                p.init_images = [last_image]\r\n                p.inpainting_fill = 1 # Set \"masked content\" to \"original\" for next loop.\r\n\r\n                if batch_count == 1:\r\n                    history.append(last_image)\r\n                    all_images.append(last_image)\r\n\r\n            if batch_count > 1 and not state.skipped and not state.interrupted:\r\n                history.append(last_image)\r\n                all_images.append(last_image)\r\n\r\n            p.inpainting_fill = original_inpainting_fill\r\n                \r\n            if state.interrupted:\r\n                    break\r\n\r\n        if len(history) > 1:\r\n            grid = images.image_grid(history, rows=1)\r\n            if opts.grid_save:\r\n                images.save_image(grid, p.outpath_grids, \"grid\", initial_seed, p.prompt, opts.grid_format, info=info, short_filename=not opts.grid_extended_filename, grid=True, p=p)\r\n\r\n            if opts.return_grid:\r\n                grids.append(grid)\r\n                \r\n        all_images = grids + all_images\r\n\r\n        processed = Processed(p, all_images, initial_seed, initial_info)\r\n\r\n        return processed\r\n", "path": "scripts/loopback.py"}], "after_files": [{"content": "import math\r\n\r\nimport gradio as gr\r\nimport modules.scripts as scripts\r\nfrom modules import deepbooru, images, processing, shared\r\nfrom modules.processing import Processed\r\nfrom modules.shared import opts, state\r\n\r\n\r\nclass Script(scripts.Script):\r\n    def title(self):\r\n        return \"Loopback\"\r\n\r\n    def show(self, is_img2img):\r\n        return is_img2img\r\n\r\n    def ui(self, is_img2img):        \r\n        loops = gr.Slider(minimum=1, maximum=32, step=1, label='Loops', value=4, elem_id=self.elem_id(\"loops\"))\r\n        final_denoising_strength = gr.Slider(minimum=0, maximum=1, step=0.01, label='Final denoising strength', value=0.5, elem_id=self.elem_id(\"final_denoising_strength\"))\r\n        denoising_curve = gr.Dropdown(label=\"Denoising strength curve\", choices=[\"Aggressive\", \"Linear\", \"Lazy\"], value=\"Linear\")\r\n        append_interrogation = gr.Dropdown(label=\"Append interrogated prompt at each iteration\", choices=[\"None\", \"CLIP\", \"DeepBooru\"], value=\"None\")\r\n\r\n        return [loops, final_denoising_strength, denoising_curve, append_interrogation]\r\n\r\n    def run(self, p, loops, final_denoising_strength, denoising_curve, append_interrogation):\r\n        processing.fix_seed(p)\r\n        batch_count = p.n_iter\r\n        p.extra_generation_params = {\r\n            \"Final denoising strength\": final_denoising_strength,\r\n            \"Denoising curve\": denoising_curve\r\n        }\r\n\r\n        p.batch_size = 1\r\n        p.n_iter = 1\r\n\r\n        info = None\r\n        initial_seed = None\r\n        initial_info = None\r\n        initial_denoising_strength = p.denoising_strength\r\n\r\n        grids = []\r\n        all_images = []\r\n        original_init_image = p.init_images\r\n        original_prompt = p.prompt\r\n        original_inpainting_fill = p.inpainting_fill\r\n        state.job_count = loops * batch_count\r\n\r\n        initial_color_corrections = [processing.setup_color_correction(p.init_images[0])]\r\n\r\n        def calculate_denoising_strength(loop):\r\n            strength = initial_denoising_strength\r\n\r\n            if loops == 1:\r\n                return strength\r\n\r\n            progress = loop / (loops - 1)\r\n            if denoising_curve == \"Aggressive\":\r\n                strength = math.sin((progress) * math.pi * 0.5)\r\n            elif denoising_curve == \"Lazy\":\r\n                strength = 1 - math.cos((progress) * math.pi * 0.5)\r\n            else:\r\n                strength = progress\r\n\r\n            change = (final_denoising_strength - initial_denoising_strength) * strength\r\n            return initial_denoising_strength + change\r\n\r\n        history = []\r\n\r\n        for n in range(batch_count):\r\n            # Reset to original init image at the start of each batch\r\n            p.init_images = original_init_image\r\n\r\n            # Reset to original denoising strength\r\n            p.denoising_strength = initial_denoising_strength\r\n\r\n            last_image = None\r\n\r\n            for i in range(loops):\r\n                p.n_iter = 1\r\n                p.batch_size = 1\r\n                p.do_not_save_grid = True\r\n\r\n                if opts.img2img_color_correction:\r\n                    p.color_corrections = initial_color_corrections\r\n\r\n                if append_interrogation != \"None\":\r\n                    p.prompt = original_prompt + \", \" if original_prompt != \"\" else \"\"\r\n                    if append_interrogation == \"CLIP\":\r\n                        p.prompt += shared.interrogator.interrogate(p.init_images[0])\r\n                    elif append_interrogation == \"DeepBooru\":\r\n                        p.prompt += deepbooru.model.tag(p.init_images[0])\r\n\r\n                state.job = f\"Iteration {i + 1}/{loops}, batch {n + 1}/{batch_count}\"\r\n\r\n                processed = processing.process_images(p)\r\n\r\n                # Generation cancelled.\r\n                if state.interrupted:\r\n                    break\r\n\r\n                if initial_seed is None:\r\n                    initial_seed = processed.seed\r\n                    initial_info = processed.info\r\n\r\n                p.seed = processed.seed + 1\r\n                p.denoising_strength = calculate_denoising_strength(i + 1)\r\n                \r\n                if state.skipped:\r\n                    break\r\n\r\n                last_image = processed.images[0]\r\n                p.init_images = [last_image]\r\n                p.inpainting_fill = 1 # Set \"masked content\" to \"original\" for next loop.\r\n\r\n                if batch_count == 1:\r\n                    history.append(last_image)\r\n                    all_images.append(last_image)\r\n\r\n            if batch_count > 1 and not state.skipped and not state.interrupted:\r\n                history.append(last_image)\r\n                all_images.append(last_image)\r\n\r\n            p.inpainting_fill = original_inpainting_fill\r\n                \r\n            if state.interrupted:\r\n                    break\r\n\r\n        if len(history) > 1:\r\n            grid = images.image_grid(history, rows=1)\r\n            if opts.grid_save:\r\n                images.save_image(grid, p.outpath_grids, \"grid\", initial_seed, p.prompt, opts.grid_format, info=info, short_filename=not opts.grid_extended_filename, grid=True, p=p)\r\n\r\n            if opts.return_grid:\r\n                grids.append(grid)\r\n                \r\n        all_images = grids + all_images\r\n\r\n        processed = Processed(p, all_images, initial_seed, initial_info)\r\n\r\n        return processed\r\n", "path": "scripts/loopback.py"}]}