Repository: AUTOMATIC1111/stable-diffusion-webui

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.


Discussion:
suggested solution: to replace match-case with if-else

Resolving patch:
diff --git a/scripts/loopback.py b/scripts/loopback.py
--- a/scripts/loopback.py
+++ b/scripts/loopback.py
@@ -54,15 +54,12 @@ def calculate_denoising_strength(loop):
                 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


Test patch: