Repository: gradio-app/gradio

Issue:
`gr.File` with `file_types="image"` breaks front-end rendering
### Describe the bug

If a `gr.File` contains the `file_types="image"` the front-end never renders due to a `Uncaught (in promise) TypeError: i.map is not a function` in the browser console
![image](https://user-images.githubusercontent.com/788417/214070991-eee5efef-2861-4aad-9568-e901e903f639.png)


### Is there an existing issue for this?

- [X] I have searched the existing issues

### Reproduction

```py
import gradio as gr
with gr.Blocks() as demo:
    gr.File(label="Test", file_count="multiple", interactive=True, file_types="image") 

demo.launch()
```
https://huggingface.co/spaces/multimodalart/grFileBug



### Screenshot

_No response_

### Logs

```shell
FileUpload.svelte:49 Uncaught (in promise) TypeError: i.map is not a function
    at Ce (FileUpload.svelte:49:27)
    at Pt (index.4395ab38.js:4:6005)
    at new Ee (FileUpload.svelte:60:30)
    at Array.Me (File.svelte:57:16)
    at Array.Se (File.svelte:40:16)
    at jn (index.4395ab38.js:1:1425)
    at _n (index.4395ab38.js:76:13914)
    at Wc (index.4395ab38.js:76:14690)
    at Pt (index.4395ab38.js:4:6206)
    at new Zc (index.4395ab38.js:76:16107)
```
### System Info

```shell
gradio==3.16.2
```


### Severity

blocking upgrade to latest gradio version


Discussion:
PS: Works perfectly in Gradio 3.15, but breaks from `3.16.0` to `3.16.2`
@apolinario Can you try with 

`gr.File(label="Test", file_count="multiple", interactive=True, file_types=["image"]) `

Works for me on main right now

<img width="1301" alt="image" src="https://user-images.githubusercontent.com/41651716/214081132-b311bef4-5183-4cbe-bc51-40ed94c9b2b8.png">


That works! Somehow I had old code that did not use a list and it used to work - so that broke on 3.16.x - but as a list it did work!
Glad it works! Will put up a PR to check that `file_types` is a list and raise an error to prevent front-end crashing

Resolving patch:
diff --git a/gradio/components.py b/gradio/components.py
--- a/gradio/components.py
+++ b/gradio/components.py
@@ -2250,6 +2250,10 @@ def __init__(
         """
         self.file_count = file_count
         self.file_types = file_types
+        if file_types is not None and not isinstance(file_types, list):
+            raise ValueError(
+                f"Parameter file_types must be a list. Received {file_types.__class__.__name__}"
+            )
         valid_types = [
             "file",
             "binary",
@@ -2982,6 +2986,10 @@ def __init__(
         """
         self.type = type
         self.file_count = file_count
+        if file_types is not None and not isinstance(file_types, list):
+            raise ValueError(
+                f"Parameter file_types must be a list. Received {file_types.__class__.__name__}"
+            )
         self.file_types = file_types
         self.label = label
         TempFileManager.__init__(self)


Test patch:
diff --git a/test/test_components.py b/test/test_components.py
--- a/test/test_components.py
+++ b/test/test_components.py
@@ -942,6 +942,12 @@ def test_component_functions(self):
         output2 = file_input.postprocess("test/test_files/sample_file.pdf")
         assert output1 == output2
 
+    def test_file_type_must_be_list(self):
+        with pytest.raises(
+            ValueError, match="Parameter file_types must be a list. Received str"
+        ):
+            gr.File(file_types=".json")
+
     def test_in_interface_as_input(self):
         """
         Interface, process
@@ -983,6 +989,12 @@ def test_component_functions(self):
         input2 = upload_input.preprocess(x_file)
         assert input1.name == input2.name
 
+    def test_raises_if_file_types_is_not_list(self):
+        with pytest.raises(
+            ValueError, match="Parameter file_types must be a list. Received int"
+        ):
+            gr.UploadButton(file_types=2)
+
 
 class TestDataframe:
     def test_component_functions(self):