internlm/SWE-Fixer-Train-110K huggingface dataset:
Repository: gradio-app/gradio

Issue:
Interpretation is not updating the input text visual
### Describe the bug

The interpretation in 3.161 is not updating the input text visual. The function hook is called but no updates. There is also a bug related to examples. Some extra text are appended in the text field after clicking on the example.

### Is there an existing issue for this?

- [X] I have searched the existing issues

### Reproduction

https://gradio.app/demos/ under "Sentiment Analysis"

### Screenshot

![image](https://user-images.githubusercontent.com/26838074/211235648-43e4bda4-7e50-49e1-8edc-8e4115610b75.png)


### Logs

```shell
No logs
```


### System Info

```shell
3.16.1
```


### Severity

blocking upgrade to latest gradio version


Discussion:
Hmm thanks for flagging the issue @yaogee, we'll take a look!

Resolving patch:
diff --git a/gradio/interface.py b/gradio/interface.py
--- a/gradio/interface.py
+++ b/gradio/interface.py
@@ -706,8 +706,7 @@ def attach_interpretation_events(
             interpretation_btn.click(
                 self.interpret_func,
                 inputs=self.input_components + self.output_components,
-                outputs=interpretation_set
-                or [] + [input_component_column, interpret_component_column],  # type: ignore
+                outputs=(interpretation_set or []) + [input_component_column, interpret_component_column],  # type: ignore
                 preprocess=False,
             )
 


Test patch:
diff --git a/test/test_interfaces.py b/test/test_interfaces.py
--- a/test/test_interfaces.py
+++ b/test/test_interfaces.py
@@ -238,6 +238,34 @@ def quadratic(num1: float, num2: float) -> float:
             interpretation="default",
         )
 
+        interpretation_id = None
+        for c in iface.config["components"]:
+            if c["props"].get("value") == "Interpret" and c.get("type") == "button":
+                interpretation_id = c["id"]
+
+        # Make sure the event is configured correctly.
+        interpretation_dep = next(
+            d
+            for d in iface.config["dependencies"]
+            if d["targets"] == [interpretation_id]
+        )
+        interpretation_comps = [
+            c["id"]
+            for c in iface.config["components"]
+            if c.get("type") == "interpretation"
+        ]
+        interpretation_columns = [
+            c["id"]
+            for c in iface.config["components"]
+            if c.get("type") == "column" and c["props"].get("variant") == "default"
+        ]
+        assert sorted(interpretation_dep["outputs"]) == sorted(
+            interpretation_comps + interpretation_columns
+        )
+        assert sorted(interpretation_dep["inputs"]) == sorted(
+            [c._id for c in iface.input_components + iface.output_components]
+        )
+
         app, _, _ = iface.launch(prevent_thread_lock=True)
         client = TestClient(app)
Repository: gradio-app/gradio

Issue:
Authentication doesnt work if the app is embedded in a frame
### Describe the bug

Pretty self explanatory, everything is working fine when I embed the gradio app in a div element except the login, which fails without any error message to the console of the browser.

### Is there an existing issue for this?

- [X] I have searched the existing issues

### Reproduction

Any gradio app that has authentication and is embedded as follows:
```
<html>
  <head>
  <meta name="keywords" content="" />
  <meta name="description" content="" />
  <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
  </head>
  <frameset rows="100%">
  <frame src="http://18.195.21.198:7860/" title="mytitle" frameborder="0" noresize="noresize"/>
  <noframes>
  <body>
 <p><a href="http://mygradiohosting:7860">http://mywebsite.com</a>     </p>
  </body>
  </noframes>
  </frameset>
  </html>
```


### Screenshot

_No response_

### Logs

```shell
No logs in gradio nor in the browser console.
```


### System Info

```shell
Gradio 3.4, Google Chrome
```


### Severity

annoying


Discussion:
Thanks @ValentinKoch! @aliabid94 do you know if this is fixed by #2112?

Should add that i am hosting on aws ec2 maybe :) if that changes things
Could be related to #2266, probably a CORS issue.

Resolving patch:
diff --git a/gradio/routes.py b/gradio/routes.py
--- a/gradio/routes.py
+++ b/gradio/routes.py
@@ -184,8 +184,14 @@ def login(form_data: OAuth2PasswordRequestForm = Depends()):
             ) or (callable(app.auth) and app.auth.__call__(username, password)):
                 token = secrets.token_urlsafe(16)
                 app.tokens[token] = username
-                response = RedirectResponse(url="/", status_code=status.HTTP_302_FOUND)
-                response.set_cookie(key="access-token", value=token, httponly=True)
+                response = JSONResponse(content={"success": True})
+                response.set_cookie(
+                    key="access-token",
+                    value=token,
+                    httponly=True,
+                    samesite="none",
+                    secure=True,
+                )
                 return response
             else:
                 raise HTTPException(status_code=400, detail="Incorrect credentials.")
@@ -206,6 +212,7 @@ def main(request: fastapi.Request, user: str = Depends(get_current_user)):
                 config = {
                     "auth_required": True,
                     "auth_message": blocks.auth_message,
+                    "is_space": app.get_blocks().is_space,
                 }
 
             try:


Test patch:
diff --git a/test/test_blocks.py b/test/test_blocks.py
--- a/test/test_blocks.py
+++ b/test/test_blocks.py
@@ -1338,7 +1338,7 @@ async def say_hello(name):
         data={"username": "abc", "password": "123"},
         follow_redirects=False,
     )
-    assert resp.status_code == 302
+    assert resp.status_code == 200
     token = resp.cookies.get("access-token")
     assert token
Repository: gradio-app/gradio

Issue:
Video ui is jumpy when the value is changed
### Describe the bug

This video shows the issue:

https://user-images.githubusercontent.com/12937446/216451342-492e8d36-1f9d-4d23-a64c-abdaa8aa8a39.mov

I think the video is jumping from video size -> default size -> video size. It would be good if it at least didn't jump down to that inbetween size.

### Is there an existing issue for this?

- [X] I have searched the existing issues

### Reproduction

https://user-images.githubusercontent.com/12937446/216451342-492e8d36-1f9d-4d23-a64c-abdaa8aa8a39.mov


### Screenshot

https://user-images.githubusercontent.com/12937446/216451342-492e8d36-1f9d-4d23-a64c-abdaa8aa8a39.mov


### Logs

```shell
no
```


### System Info

```shell
no
```


### Severity

annoying


Discussion:

Resolving patch:
diff --git a/demo/video_component/run.py b/demo/video_component/run.py
--- a/demo/video_component/run.py
+++ b/demo/video_component/run.py
@@ -1,8 +1,22 @@
-import gradio as gr 
+import gradio as gr
+import os
 
-css = "footer {display: none !important;} .gradio-container {min-height: 0px !important;}"
 
-with gr.Blocks(css=css) as demo:
-    gr.Video()
+a = os.path.join(os.path.dirname(__file__), "files/world.mp4")  # Video
+b = os.path.join(os.path.dirname(__file__), "files/a.mp4")  # Video
+c = os.path.join(os.path.dirname(__file__), "files/b.mp4")  # Video
 
-demo.launch()
\ No newline at end of file
+
+demo = gr.Interface(
+    fn=lambda x: x,
+    inputs=gr.Video(type="file"),
+    outputs=gr.Video(),
+    examples=[
+        [a],
+        [b],
+        [c],
+    ],
+)
+
+if __name__ == "__main__":
+    demo.launch()
diff --git a/scripts/copy_demos.py b/scripts/copy_demos.py
--- a/scripts/copy_demos.py
+++ b/scripts/copy_demos.py
@@ -34,6 +34,7 @@ def copy_all_demos(source_dir: str, dest_dir: str):
         "stt_or_tts",
         "stream_audio",
         "stream_frames",
+        "video_component",
         "zip_files",
     ]
     for demo in demos_to_copy:


Test patch:
Repository: gradio-app/gradio

Issue:
%%blocks cell magic doesn't work
### Describe the bug

Unable to use %%blocks in Colab. The following code snippet is just a random one copied from Gradio example.


```py
%%blocks

def generate(text):
    "hi"

examples = [
    ["The Moon's orbit around Earth has"],
    ["The smooth Borealis basin in the Northern Hemisphere covers 40%"],
]

demo = gr.Interface(
    fn=generate,
    inputs=gr.inputs.Textbox(lines=5, label="Input Text"),
    outputs=gr.outputs.Textbox(label="Generated Text"),
    examples=examples
)
```

### Is there an existing issue for this?

- [X] I have searched the existing issues

### Reproduction

https://colab.research.google.com/drive/1ziLOFs-nSyUgUeo4WBkf1TIfrLPxkgDu?usp=sharing

### Screenshot

<img width="939" alt="image" src="https://user-images.githubusercontent.com/38108242/213739638-7853b185-f769-4c3d-8005-c65902fb5185.png">


### Logs

```shell
---------------------------------------------------------------------------
DuplicateBlockError                       Traceback (most recent call last)
<ipython-input-18-0e7a87c35f47> in <module>
----> 1 get_ipython().run_cell_magic('blocks', '', '\n\n\ndef generate(text):\n    "hi"\n\nexamples = [\n    ["The Moon\'s orbit around Earth has"],\n    ["The smooth Borealis basin in the Northern Hemisphere covers 40%"],\n]\n\ndemo = gr.Interface(\n    fn=generate,\n    inputs=gr.inputs.Textbox(lines=5, label="Input Text"),\n    outputs=gr.outputs.Textbox(label="Generated Text"),\n    examples=examples\n)\n')

5 frames
/usr/local/lib/python3.8/dist-packages/gradio/blocks.py in render(self)
     85         """
     86         if Context.root_block is not None and self._id in Context.root_block.blocks:
---> 87             raise DuplicateBlockError(
     88                 f"A block with id: {self._id} has already been rendered in the current Blocks."
     89             )

DuplicateBlockError: A block with id: 62 has already been rendered in the current Blocks.
```


### System Info

```shell
Colab, no GPU
```


### Severity

serious, but I can work around it


Discussion:
Can confirm the issue, will look into it!
I think this only fails if you're running an interface. 

<img width="1452" alt="image" src="https://user-images.githubusercontent.com/41651716/214561126-d1248e3b-7b74-4ff1-a0d9-10f180bba2a5.png">


Hmm this is kinda tricky since the cell magic defines a global blocks context that conflicts with the one created with the gr.Interface. 

Resolving patch:
diff --git a/gradio/ipython_ext.py b/gradio/ipython_ext.py
--- a/gradio/ipython_ext.py
+++ b/gradio/ipython_ext.py
@@ -3,6 +3,8 @@
 except ImportError:
     pass
 
+import warnings
+
 import gradio
 
 
@@ -12,6 +14,8 @@ def load_ipython_extension(ipython):
     @register_cell_magic
     @needs_local_scope
     def blocks(line, cell, local_ns=None):
+        if "gr.Interface" in cell:
+            warnings.warn("Usage of gr.Interface with %%blocks may result in errors.")
         with __demo.clear():
             exec(cell, None, local_ns)
             __demo.launch(quiet=True)


Test patch:
Repository: gradio-app/gradio

Issue:
Markdown: LaTeX font is black and unreadable in the dark theme
### Describe the bug

The LaTeX font is dark instead of light in the dark theme, rendering it unreadable.

### Is there an existing issue for this?

- [X] I have searched the existing issues

### Reproduction

```python
import gradio as gr

with gr.Blocks() as interface:
    gr.Markdown(value="$ x = 1+1$")

interface.launch()
```

Run the script above.

* Under `http://127.0.0.1:7860/`, the equation is readable.
* Under `http://127.0.0.1:7860/?__theme=dark`, the equation is present but unreadable.

### Screenshot

_No response_

### Logs

```shell
-
```


### System Info

```shell
gradio==3.18.0
```


### Severity

annoying


Discussion:

Resolving patch:
diff --git a/demo/calculator/run.py b/demo/calculator/run.py
--- a/demo/calculator/run.py
+++ b/demo/calculator/run.py
@@ -27,7 +27,7 @@ def calculator(num1, operation, num2):
         [0, "subtract", 1.2],
     ],
     title="Toy Calculator",
-    description="Here's a sample toy calculator. Enjoy!",
+    description="Here's a sample toy calculator. Allows you to calculate things like $2+2=4$",
 )
 if __name__ == "__main__":
     demo.launch()
diff --git a/gradio/interface.py b/gradio/interface.py
--- a/gradio/interface.py
+++ b/gradio/interface.py
@@ -307,7 +307,7 @@ def clean_html(raw_html):
                     "html": True,
                 },
             )
-            .use(dollarmath_plugin)
+            .use(dollarmath_plugin, renderer=utils.tex2svg, allow_digits=False)
             .use(footnote_plugin)
             .enable("table")
         )


Test patch:
Repository: gradio-app/gradio

Issue:
3.16.0 introduced breaking change for Dropdown
### Describe the bug

The addition of the multiselect option to `Dropdown` introduced a breaking change for the Dropdown components output signature. The default case when there is no value (for example, an optional dropdown that a user does not interact with before submitting) is now an array (list on the python side) instead of an empty string. This means checks like `dropdown == ""` etc will now be False rather than True.

I think it is fine if users select an option and _then_ select nothing.

This is the offending line: https://github.com/gradio-app/gradio/pull/2871/files#diff-f0b03055e354ad5f6f0c4c006adba9a9fe60a07ca1790b75e20cd0b69737ede8R11

### Is there an existing issue for this?

- [X] I have searched the existing issues

### Reproduction

Above.

### Screenshot

-

### Logs

```shell
-
```


### System Info

```shell
-
```


### Severity

blocking upgrade to latest gradio version


Discussion:
Wouldn't it make sense to have the default be `""` if `multiselect=False` and be `[]` if `multiselect=True`?
Yeah, thats what it should be and brings it back to the previous behaviour.

We can consider aligning the types in 4.0.

Resolving patch:
diff --git a/gradio/components.py b/gradio/components.py
--- a/gradio/components.py
+++ b/gradio/components.py
@@ -1259,7 +1259,8 @@ def __init__(
             value=value,
             **kwargs,
         )
-        self.cleared_value = self.value
+
+        self.cleared_value = self.value or ([] if multiselect else "")
 
     def get_config(self):
         return {
diff --git a/gradio/utils.py b/gradio/utils.py
--- a/gradio/utils.py
+++ b/gradio/utils.py
@@ -886,11 +886,11 @@ def tex2svg(formula, *args):
     svg_start = xml_code.index("<svg ")
     svg_code = xml_code[svg_start:]
     svg_code = re.sub(r"<metadata>.*<\/metadata>", "", svg_code, flags=re.DOTALL)
-    svg_code = re.sub(r' width="[^"]+"', '', svg_code)
+    svg_code = re.sub(r' width="[^"]+"', "", svg_code)
     height_match = re.search(r'height="([\d.]+)pt"', svg_code)
     if height_match:
         height = float(height_match.group(1))
-        new_height = height / FONTSIZE   # conversion from pt to em
+        new_height = height / FONTSIZE  # conversion from pt to em
         svg_code = re.sub(r'height="[\d.]+pt"', f'height="{new_height}em"', svg_code)
     copy_code = f"<span style='font-size: 0px'>{formula}</span>"
     return f"{copy_code}{svg_code}"


Test patch:
Repository: gradio-app/gradio

Issue:
Have option to display gallery in preview state 
- [x] I have searched to see if a similar issue already exists.


**Is your feature request related to a problem? Please describe.**  
As a user, it would be great to have the option to display the gallery in a preview state (what it looks like when an image is clicked):

<img width="667" alt="image" src="https://user-images.githubusercontent.com/41651716/221232958-0910785d-26ad-4518-8182-67245c9a3280.png">


**Describe the solution you'd like**  
Add `preview=True|False` to the `style` method. I guess default to `False` to not change behavior of apps that upgrade versions. 


**Additional context**  

cc @sashavor


Discussion:

Resolving patch:
diff --git a/gradio/components.py b/gradio/components.py
--- a/gradio/components.py
+++ b/gradio/components.py
@@ -1241,7 +1241,9 @@ def __init__(
             if isinstance(value, str):
                 value = [value]
         if not multiselect and max_choices is not None:
-            warnings.warn("The `max_choices` parameter is ignored when `multiselect` is False.")
+            warnings.warn(
+                "The `max_choices` parameter is ignored when `multiselect` is False."
+            )
         self.max_choices = max_choices
         self.test_input = self.choices[0] if len(self.choices) else None
         self.interpret_by_tokens = False
@@ -3831,6 +3833,7 @@ def style(
         grid: int | Tuple | None = None,
         height: str | None = None,
         container: bool | None = None,
+        preview: bool | None = None,
         **kwargs,
     ):
         """
@@ -3844,6 +3847,8 @@ def style(
             self._style["grid"] = grid
         if height is not None:
             self._style["height"] = height
+        if preview is not None:
+            self._style["preview"] = preview
 
         return Component.style(self, container=container, **kwargs)
 


Test patch:
Repository: gradio-app/gradio

Issue:
Event Handler Parameter Documentation not showing on main
### Describe the bug


On main: https://gradio.app/docs/main/#audio
<img width="1079" alt="image" src="https://user-images.githubusercontent.com/41651716/224377044-291f99be-ae46-46f3-80fc-3ac6e940a98e.png">

On latest:
<img width="1049" alt="image" src="https://user-images.githubusercontent.com/41651716/224377167-7a9a2fd5-1348-46b6-aeeb-e31fe62b8e48.png">


### Is there an existing issue for this?

- [X] I have searched the existing issues

### Reproduction

-

### Screenshot

_No response_

### Logs

```shell
-
```


### System Info

```shell
-
```


### Severity

annoying


Discussion:
Hmmm @aliabid94 
Think I figured it out

Resolving patch:
diff --git a/gradio/documentation.py b/gradio/documentation.py
--- a/gradio/documentation.py
+++ b/gradio/documentation.py
@@ -198,15 +198,25 @@ def generate_documentation():
                 instance_attribute_fn = fn_name.startswith("*")
                 if instance_attribute_fn:
                     fn_name = fn_name[1:]
-                    fn = getattr(cls(), fn_name)
+                    # Instance attribute fns are classes
+                    # whose __call__ method determines their behavior
+                    fn = getattr(cls(), fn_name).__call__
                 else:
                     fn = getattr(cls, fn_name)
-                (
-                    description_doc,
-                    parameter_docs,
-                    return_docs,
-                    examples_doc,
-                ) = document_fn(fn, cls)
+                if not callable(fn):
+                    description_doc = str(fn)
+                    parameter_docs = {}
+                    return_docs = {}
+                    examples_doc = ""
+                    override_signature = f"gr.{cls}.{fn}"
+                else:
+                    (
+                        description_doc,
+                        parameter_docs,
+                        return_docs,
+                        examples_doc,
+                    ) = document_fn(fn, cls)
+                    override_signature = None
                 if instance_attribute_fn:
                     description_doc = extract_instance_attr_doc(cls, fn_name)
                 cls_documentation["fns"].append(
@@ -218,6 +228,7 @@ def generate_documentation():
                         "parameters": parameter_docs,
                         "returns": return_docs,
                         "example": examples_doc,
+                        "override_signature": override_signature
                     }
                 )
             documentation[mode].append(cls_documentation)


Test patch:
Repository: gradio-app/gradio

Issue:
Button.click gets an empty file input
### Describe the bug

If I use a `gr.File` object as an input of `Button.click()`, the corresponding event handler function will get an empty file.

### Is there an existing issue for this?

- [X] I have searched the existing issues

### Reproduction

```python
import gradio as gr

with gr.Blocks() as demo:
    file = gr.File()
    upload = gr.Button('Upload')
    data = gr.Textbox(label='Data')
    upload.click(lambda f: f.read(), inputs=[file], outputs=[data])

demo.launch()
```

### Screenshot

<img width="765" alt="image" src="https://user-images.githubusercontent.com/5109942/228165303-d90475df-c333-4d89-9950-9f50679e2234.png">


### Logs

```shell
No helpful logs.
```


### System Info

```shell
gradio==v3.23.1b2
Mac
```


### Severity

blocking upgrade to latest gradio version


Discussion:

Resolving patch:
diff --git a/gradio/components.py b/gradio/components.py
--- a/gradio/components.py
+++ b/gradio/components.py
@@ -2454,7 +2454,7 @@ class File(
 ):
     """
     Creates a file component that allows uploading generic file (when used as an input) and or displaying generic files (output).
-    Preprocessing: passes the uploaded file as a {file-object} or {List[file-object]} depending on `file_count` (or a {bytes}/{List{bytes}} depending on `type`)
+    Preprocessing: passes the uploaded file as a {tempfile._TemporaryFileWrapper} or {List[tempfile._TemporaryFileWrapper]} depending on `file_count` (or a {bytes}/{List{bytes}} depending on `type`)
     Postprocessing: expects function to return a {str} path to a file, or {List[str]} consisting of paths to files.
     Examples-format: a {str} path to a local file that populates the component.
     Demos: zip_to_json, zip_files


Test patch:
Repository: gradio-app/gradio

Issue:
Login Page styling regressed
### Describe the bug

The login page styling looks weird. The gray boxes look bad and they are new. See this space: https://huggingface.co/spaces/gradio/hello_login

<img width="1166" alt="image" src="https://github.com/gradio-app/gradio/assets/41651716/7e8664d7-59b3-48a1-9e12-f755e3272fdd">


### Have you searched existing issues?  🔎

- [X] I have searched and found no existing issues

### Reproduction

Go to this space https://huggingface.co/spaces/gradio/hello_login

Seems to be a regression introduced in the last release

### Screenshot

_No response_

### Logs

_No response_

### System Info

```shell
gradio 3.35.2
```


### Severity

I can work around it


Discussion:

Resolving patch:
diff --git a/gradio/blocks.py b/gradio/blocks.py
--- a/gradio/blocks.py
+++ b/gradio/blocks.py
@@ -1957,13 +1957,8 @@ def reverse(text):
 
         # Check if running in a Python notebook in which case, display inline
         if inline is None:
-            inline = utils.ipython_check() and (self.auth is None)
+            inline = utils.ipython_check()
         if inline:
-            if self.auth is not None:
-                print(
-                    "Warning: authentication is not supported inline. Please"
-                    "click the link to access the interface in a new tab."
-                )
             try:
                 from IPython.display import HTML, Javascript, display  # type: ignore
 


Test patch:
diff --git a/js/app/test/components.test.ts b/js/app/test/components.test.ts
--- a/js/app/test/components.test.ts
+++ b/js/app/test/components.test.ts
@@ -75,7 +75,7 @@ const components = [
 	// ["Plot", Plot, {}],
 	["Radio", Radio, {}],
 	["Slider", Slider, {}],
-	["Textbox", Textbox, {}],
+	["Textbox", Textbox, { container: false }],
 	["TimeSeries", TimeSeries, {}],
 	["UploadButton", UploadButton, {}],
 	["Video", Video, {}]