Repository: gradio-app/gradio

Issue:
3.0.1 Dataframe empty row
### Is there an existing issue for this?

- [X] I have searched the existing issues

### Describe the bug

@pngwn 
I am using gradio 3.0.1 and found that there is a problem with blank rows in Dataframe output: when the data is less than 3 rows, there are blank rows, as shown in the figure.

### Reproduction

![ksnip_20220517-083436](https://user-images.githubusercontent.com/41098760/168704084-19c0509c-e575-4443-9e97-089315aab9a7.png)

![ksnip_20220517-083448](https://user-images.githubusercontent.com/41098760/168704105-482e8de0-a449-4c16-9ae5-f67f2d2cc0a6.png)


![ksnip_20220517-083504](https://user-images.githubusercontent.com/41098760/168704113-43d4e002-862e-4608-b69f-0bc9e1f941f2.png)



### Screenshot

_No response_

### Logs

_No response_

### System Info

```shell
gradio 3.0.1
ubuntu 20.04
chrome
```


### Severity

annoyance


Discussion:
Can you show me the code you are using to generate this Dataframe please.
@pngwn 
My project: https://huggingface.co/spaces/Zengyf-CVer/Gradio_YOLOv5_Det_v3
You can enter a picture with a picture of one object or two objects.

Ah thanks.
What is happening here is the dataframe is always respecting the `row_count` as a minimum. If you set row_count to `1` on the Dataframe it works as expected. Not sure what the best behaviour is here.

cc @abidlabs @aliabid94 
Just to clarify, the default row_count is `3` which is why those 3 rows are visible.
This seems like reasonable behavior to me for the Dataframe to initialize with the stated number of rows. What we need to do is implement a "delete row / delete column" functionality to address these kinds of situations
This specific case is about whether the rows should match what comes back from the predict function or if it should respect the row count in that case as well. As an output the dataframe wouldn't have add/ delete functionality. 

Input and outputs aren't significantly different so what makes sense for an input doesn't _always_ make sense for an output (although I'm not sure that is the case here) but we can modify the behaviour of static vs dynamic components.
When the output Dataframe defaults to 3 lines, it will make users think that there is an illusion of outputting empty lines.
> This specific case is about whether the rows should match what comes back from the predict function or if it should respect the row count in that case as well. As an output the dataframe wouldn't have add/ delete functionality.

Oh sorry I didn't read carefully. Going off of your comment @pngwn, what if we make the default # of rows be 0 or 1. We could do this for static dataframes only, but I don't see it being a problem for dynamic dataframes either (especially right now given that you can only add rows, not delete them). 
(sorry accidentally closed)

Resolving patch:
diff --git a/gradio/components.py b/gradio/components.py
--- a/gradio/components.py
+++ b/gradio/components.py
@@ -2419,7 +2419,7 @@ def __init__(
         value: Optional[List[List[Any]]] = None,
         *,
         headers: Optional[List[str]] = None,
-        row_count: int | Tuple[int, str] = (3, "dynamic"),
+        row_count: int | Tuple[int, str] = (1, "dynamic"),
         col_count: Optional[int | Tuple[int, str]] = None,
         datatype: str | List[str] = "str",
         type: str = "pandas",


Test patch:
diff --git a/test/test_components.py b/test/test_components.py
--- a/test/test_components.py
+++ b/test/test_components.py
@@ -1037,13 +1037,11 @@ def test_component_functions(self):
             {
                 "headers": ["Name", "Age", "Member"],
                 "datatype": ["str", "str", "str"],
-                "row_count": (3, "dynamic"),
+                "row_count": (1, "dynamic"),
                 "col_count": (3, "dynamic"),
                 "value": {
                     "data": [
                         ["", "", ""],
-                        ["", "", ""],
-                        ["", "", ""],
                     ],
                     "headers": ["Name", "Age", "Member"],
                 },
@@ -1082,13 +1080,11 @@ def test_component_functions(self):
                 "elem_id": None,
                 "visible": True,
                 "datatype": ["str", "str", "str"],
-                "row_count": (3, "dynamic"),
+                "row_count": (1, "dynamic"),
                 "col_count": (3, "dynamic"),
                 "value": {
                     "data": [
                         ["", "", ""],
-                        ["", "", ""],
-                        ["", "", ""],
                     ],
                     "headers": [1, 2, 3],
                 },