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

Issue:
List python runtime dependencies in requirements.txt as opposed to setup.py
- [ ] I have searched to see if a similar issue already exists.


**Is your feature request related to a problem? Please describe.**  
As a gradio developer, I think it's frustrating that the `gradio-egg.info` folder is tracked in version control. Whenever I build gradio locally, there are changes in the `gradio-egg.info` directory that are not related to my PR.

I see that `gradio-egg.info` is only included in the repo so that we can
1. cache the env in circleci 
2. install all dependencies in the `install_test_requirements.sh` script

**Describe the solution you'd like**  
I'd like to specify all dependencies in a `requirements.txt` file. That will allow us to still cache the circle-ci env. I don't think we need to install the gradio dependencies again in `install_test_requirements.sh` since that's done in `install_gradio.sh` but we can still install from `requirements.txt` if necessary. 

This will also allow us to remove `gradio-egg.info` from version control. 

**Additional context**  
Add any other context or screenshots about the feature request here.



Discussion:

Resolving patch:
diff --git a/gradio/__init__.py b/gradio/__init__.py
--- a/gradio/__init__.py
+++ b/gradio/__init__.py
@@ -1,4 +1,4 @@
-import pkg_resources
+from importlib.metadata import version
 
 import gradio.components as components
 import gradio.inputs as inputs
@@ -67,5 +67,5 @@
     Webcam,
 )
 
-current_pkg_version = pkg_resources.require("gradio")[0].version
+current_pkg_version = version("gradio")
 __version__ = current_pkg_version
diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -15,6 +15,9 @@
 version = (this_directory / "gradio" / "version.txt").read_text(
     encoding='utf8').strip()
 
+with open("requirements.txt") as reqs:
+    requirements = reqs.readlines()
+
 setup(
     name="gradio",
     version=version,
@@ -28,28 +31,7 @@
     packages=["gradio"],
     license="Apache License 2.0",
     keywords=["machine learning", "visualization", "reproducibility"],
-    install_requires=[
-        "analytics-python",
-        "aiohttp",
-        "fastapi",
-        "ffmpy",
-        "markdown-it-py[linkify,plugins]",
-        "matplotlib",
-        "numpy",
-        "orjson",
-        "pandas",
-        "paramiko",
-        "pillow",
-        "pycryptodome",
-        "python-multipart",
-        "pydub",
-        "requests",
-        "uvicorn",
-        "Jinja2",
-        "fsspec",
-        "httpx",
-        "pydantic",
-    ],
+    install_requires=requirements,
     entry_points={
         'console_scripts': ['gradio=gradio.reload:run_in_reload_mode']
     },


Test patch:
diff --git a/scripts/install_test_requirements.sh b/scripts/install_test_requirements.sh
--- a/scripts/install_test_requirements.sh
+++ b/scripts/install_test_requirements.sh
@@ -5,7 +5,7 @@ if [ -z "$(ls | grep CONTRIBUTING.md)" ]; then
 else
   echo "Installing requirements for tests"
   pip install --upgrade pip
-  pip install -r gradio.egg-info/requires.txt
+  pip install -r requirements.txt
   pip install -r test/requirements.txt
 fi
Repository: gradio-app/gradio

Issue:
Dropdown is disabled when created with blocks
### Describe the bug

Hi,
Tried creating gradio app with blocks, Dropdown was disabled after launch.


### Is there an existing issue for this?

- [x] I have searched the existing issues

### Reproduction

```
import gradio as gr

demo = gr.Blocks()

with demo:
    with gr.Tabs():
        with gr.TabItem("Record Video"):
        
            with gr.Row():
                inp1=gr.inputs.Video(source="webcam",optional=False,label='Capture Video')
                inp2=gr.inputs.Video(source="webcam",optional=False,label='Capture Video')
            with gr.Row():
                subject_id = gr.inputs.Dropdown(["cat", "dog", "bird"])
    
        
demo.launch()
```

### Screenshot

<img width="1283" alt="image" src="https://user-images.githubusercontent.com/102731859/173801150-712bc70e-479a-456e-a12b-7e0bb293bdf5.png">
<img width="915" alt="image" src="https://user-images.githubusercontent.com/102731859/173801336-8f571c6d-026e-457e-8269-192f5d4ecc4d.png">


### Logs

```shell
NA
```


### System Info

```shell
Browser: Chrome
Gradio Version: 3.0.17
```


### Severity

blocking all usage of gradio


Discussion:
Thanks for raising this issue. Once you make an event listener that takes the dropdown as an input, the dropdown will be activated. But I thought we removed disabled for elements by default, @pngwn? 
Will fix. For now, you can either use `gr.Dropdown(choices=[...], interactive=True)`, or just create an event listener that takes the dropdown as input.

@aliabid94 thanks, suggestion worked!
re-opening for now just to close this when components are interactive by default.
Btw @aliabid94 it looks some of the other form components are also not interactive by default: e.g. `Radio` and `Slider` and `Checkbox` and possibly others
This feels like a regression, I'm pretty sure we had this working fine a short while ago. Will investigate.

Resolving patch:
diff --git a/gradio/components.py b/gradio/components.py
--- a/gradio/components.py
+++ b/gradio/components.py
@@ -1233,9 +1233,7 @@ def postprocess(self, y):
         Returns:
         (str): string of choice
         """
-        return (
-            y if y is not None else self.choices[0] if len(self.choices) > 0 else None
-        )
+        return y
 
     def deserialize(self, x):
         """


Test patch:
diff --git a/test/test_components.py b/test/test_components.py
--- a/test/test_components.py
+++ b/test/test_components.py
@@ -537,7 +537,7 @@ def test_component_functions(self):
             radio_input.get_config(),
             {
                 "choices": ["a", "b", "c"],
-                "value": "a",
+                "value": None,
                 "name": "radio",
                 "show_label": True,
                 "label": "Pick Your One Input",
Repository: gradio-app/gradio

Issue:
ColorPicker component does not appear in documentation
### Describe the bug

The color picker component does not show up in the documentation. 

### Is there an existing issue for this?

- [X] I have searched the existing issues

### Reproduction

Go to gradio.app/docs/

### Screenshot

![image](https://user-images.githubusercontent.com/41651716/178077152-e9d4401f-2e01-406c-b889-6069fcea7de7.png)


### Logs

```shell
-
```


### System Info

```shell
-
```


### Severity

annoying


Discussion:

Resolving patch:
diff --git a/gradio/components.py b/gradio/components.py
--- a/gradio/components.py
+++ b/gradio/components.py
@@ -2883,6 +2883,7 @@ def style(
         )
 
 
+@document()
 class ColorPicker(Changeable, Submittable, IOComponent):
     """
     Creates a color picker for user to select a color as string input.
@@ -2905,12 +2906,12 @@ def __init__(
     ):
         """
         Parameters:
-        value (str): default text to provide in color picker.
-        label (Optional[str]): component name in interface.
-        show_label (bool): if True, will display label.
-        interactive (Optional[bool]): if True, will be rendered as an editable color picker; if False, editing will be disabled. If not provided, this is inferred based on whether the component is used as an input or output.
-        visible (bool): If False, component will be hidden.
-        elem_id (Optional[str]): An optional string that is assigned as the id of this component in the HTML DOM. Can be used for targeting CSS styles.
+            value: default text to provide in color picker.
+            label: component name in interface.
+            show_label: if True, will display label.
+            interactive: if True, will be rendered as an editable color picker; if False, editing will be disabled. If not provided, this is inferred based on whether the component is used as an input or output.
+            visible: If False, component will be hidden.
+            elem_id: An optional string that is assigned as the id of this component in the HTML DOM. Can be used for targeting CSS styles.
         """
         self.value = self.postprocess(value)
         self.cleared_value = "#000000"


Test patch:
Repository: gradio-app/gradio

Issue:
Why is gr.dataframe not found in official documentation?
Is the component description missing from the official documentation?
Also, is there a component that supports arrays directly?
Also, I used HuggingFece to build an API interface for uploading Excel files on gr.File. How to submit the body part?

I build the app address is: https://huggingface.co/spaces/changxin/pq

Also you can look at: https://hf.space/embed/changxin/pq/+

API address is: https://hf.space/embed/changxin/pq/+/api/df

Input Payload

{

"data": [

(List[Dict[name: str, data: str]]), // represents str, data: str]]): List of JSON objects with filename as 'name' property and base64 data as 'data' property of 'Select the Excel File' File that you want to read component

]

}
How do I build the body part of this post api?



Discussion:
Thanks for filing @tt0203 ! Yep, `Dataframe` should be a part of the documentation I'll make a note of this in #1673 .

Regarding the body of the post api, I think something alone these lines will work:


```python
import os
import requests
from gradio.processing_utils import encode_file_to_base64

data = encode_file_to_base64(filepath)

prediction = requests.post(url, json={"data": data, "name": filepath, "size": os.path.getsize(filepath)})
```

Can you explain your use case a bit more? Curious why you're trying to hit the api manually.



Resolving patch:
diff --git a/gradio/components.py b/gradio/components.py
--- a/gradio/components.py
+++ b/gradio/components.py
@@ -2396,12 +2396,13 @@ class DataframeData(TypedDict):
     data: List[List[str | int | bool]]
 
 
+@document()
 class Dataframe(Changeable, IOComponent):
     """
     Accepts or displays 2D input through a spreadsheet-like component for dataframes.
     Preprocessing: passes the uploaded spreadsheet data as a {pandas.DataFrame}, {numpy.array}, {List[List]}, or {List} depending on `type`
     Postprocessing: expects a {pandas.DataFrame}, {numpy.array}, {List[List]}, {List}, or {str} path to a csv, which is rendered in the spreadsheet.
-
+    Examples-format: a {str} filepath to a csv with data.
     Demos: filter_records, matrix_transpose, tax_calculator
     """
 


Test patch:
Repository: gradio-app/gradio

Issue:
Remove usage of deprecated inputs and outputs from docs and guides
- [x] I have searched to see if a similar issue already exists.


**Is your feature request related to a problem? Please describe.**  
As a gradio user, I don't want to see usage of the deprecated `gr.inputs` and `gr.outputs` in the examples and guides.

Here is an example from the "Hugging face integrations" guide

![image](https://user-images.githubusercontent.com/41651716/178808204-810d8ec5-c7e9-43a2-a1aa-dbefe8ed33f0.png)

**Describe the solution you'd like**  
Remove usage of deprecated `gr.inputs` and `gr.outputs` guides. 

**Additional context**  
Add any other context or screenshots about the feature request here.



Discussion:

Resolving patch:
diff --git a/demo/chatbot_demo/run.py b/demo/chatbot_demo/run.py
--- a/demo/chatbot_demo/run.py
+++ b/demo/chatbot_demo/run.py
@@ -17,7 +17,7 @@ def chat(message, history):
     return history, history
 
 
-chatbot = gr.Chatbot(color_map=("green", "pink")).style()
+chatbot = gr.Chatbot().style(color_map=("green", "pink"))
 demo = gr.Interface(
     chat,
     ["text", "state"],
diff --git a/demo/image_mod/run.py b/demo/image_mod/run.py
--- a/demo/image_mod/run.py
+++ b/demo/image_mod/run.py
@@ -6,7 +6,7 @@ def image_mod(image):
     return image.rotate(45)
 
 
-demo = gr.Interface(image_mod, gr.inputs.Image(type="pil"), "image", 
+demo = gr.Interface(image_mod, gr.Image(type="pil"), "image",
     flagging_options=["blurry", "incorrect", "other"], examples=[
         os.path.join(os.path.dirname(__file__), "images/cheetah1.jpg"),
         os.path.join(os.path.dirname(__file__), "images/lion.jpg"),


Test patch:
Repository: gradio-app/gradio

Issue:
requirements.txt not bundled on pypi
### Describe the bug

The pypi tarball does not include `requirements.txt`. This has become a problem since #1669 was merged.
The fix is likely much like #1706.

... While at it: it doesn't seem like `test/test_files/*` are included either.

### Is there an existing issue for this?

- [X] I have searched the existing issues

### Reproduction

```shell
$ curl 'https://files.pythonhosted.org/packages/90/5f/cd78734cb3cc0ce4decafc07fc7d06e55870d75e1ab14bf96cde412dd87c/gradio-3.0.26.tar.gz' | tar ztvf - | grep -E '(requirements.txt|test/test_files)' || echo "not found!"
not found!
```


### Screenshot

_No response_

### Logs

```shell
FileNotFoundError in setup.py regarding requirements.txt
```


### System Info

```shell
gradio version: 3.0.26
nixos: 22.05
```


### Severity

annoying


Discussion:
Thank you for filing @pbsds ! I can fix
BTW @pbsds we started automatically tagging all of our releases on github starting with 3.0.25.

Not sure what's needed for nixpkgs but I think you should be able to do

`pip install https://github.com/gradio-app/gradio/archive/refs/tags/v3.0.25.tar.gz` 

Super cool that you're adding gradio to nixpkgs btw. I'll add the files you listed here to the source distribution but maybe you can use the github releases as well. 

Also, I assume you need `test/requirements.txt` to install the test dependencies? 

Resolving patch:
diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -28,7 +28,7 @@
     author="Abubakar Abid, Ali Abid, Ali Abdalla, Dawood Khan, Ahsen Khaliq, Pete Allen, Ömer Faruk Özdemir",
     author_email="team@gradio.app",
     url="https://github.com/gradio-app/gradio",
-    packages=["gradio", "gradio.test_data"],
+    packages=["gradio", "gradio.test_data", "test.test_files"],
     license="Apache License 2.0",
     keywords=["machine learning", "visualization", "reproducibility"],
     install_requires=requirements,


Test patch:
Repository: gradio-app/gradio

Issue:
Add a guide on using interpretations from Blocks
- [x] I have searched to see if a similar issue already exists.


**Is your feature request related to a problem? Please describe.**  
The docs only explain interpretations in the context of `Interface`s but it's possible to add interpretations to a demo built with the blocks api.


**Describe the solution you'd like**  
Write a guide on how to add interpretations to a demo built with the blocks api. 

**Additional context**  
Add any other context or screenshots about the feature request here.



Discussion:

Resolving patch:
diff --git a/demo/blocks_interpretation/run.py b/demo/blocks_interpretation/run.py
new file mode 100644
--- /dev/null
+++ b/demo/blocks_interpretation/run.py
@@ -0,0 +1,57 @@
+import gradio as gr
+import shap
+from transformers import pipeline
+import matplotlib
+import matplotlib.pyplot as plt
+matplotlib.use('Agg')
+
+
+sentiment_classifier = pipeline("text-classification", return_all_scores=True)
+
+
+def classifier(text):
+    pred = sentiment_classifier(text)
+    return {p["label"]: p["score"] for p in pred[0]}
+
+
+def interpretation_function(text):
+    explainer = shap.Explainer(sentiment_classifier)
+    shap_values = explainer([text])
+    # Dimensions are (batch size, text size, number of classes)
+    # Since we care about positive sentiment, use index 1
+    scores = list(zip(shap_values.data[0], shap_values.values[0, :, 1]))
+
+    scores_desc = sorted(scores, key=lambda t: t[1])[::-1]
+
+    # Filter out empty string added by shap
+    scores_desc = [t for t in scores_desc if t[0] != ""]
+
+    fig_m = plt.figure()
+    plt.bar(x=[s[0] for s in scores_desc[:5]],
+            height=[s[1] for s in scores_desc[:5]])
+    plt.title("Top words contributing to positive sentiment")
+    plt.ylabel("Shap Value")
+    plt.xlabel("Word")
+    return {"original": text, "interpretation": scores}, fig_m
+
+
+with gr.Blocks() as demo:
+    with gr.Row():
+        with gr.Column():
+            input_text = gr.Textbox(label="Input Text")
+            with gr.Row():
+                classify = gr.Button("Classify Sentiment")
+                interpret = gr.Button("Interpret")
+        with gr.Column():
+            label = gr.Label(label="Predicted Sentiment")
+        with gr.Column():
+            with gr.Tabs():
+                with gr.TabItem("Display interpretation with built-in component"):
+                    interpretation = gr.components.Interpretation(input_text)
+                with gr.TabItem("Display interpretation with plot"):
+                    interpretation_plot = gr.Plot()
+
+    classify.click(classifier, input_text, label)
+    interpret.click(interpretation_function, input_text, [interpretation, interpretation_plot])
+
+demo.launch()
\ No newline at end of file


Test patch:
Repository: gradio-app/gradio

Issue:
Add documentation for the Dataset component
- [x] I have searched to see if a similar issue already exists.

If I go to https://gradio.app/docs/#examples-header, it mentions that `gr.Examples` is a wrapper around the `Dataset` component, but I don't find any info on this component. Docs and info on `gr.Dataset` would be super useful!


Discussion:
CC @freddyaboulton 

Resolving patch:
diff --git a/gradio/__init__.py b/gradio/__init__.py
--- a/gradio/__init__.py
+++ b/gradio/__init__.py
@@ -26,6 +26,7 @@
     Highlightedtext,
     HighlightedText,
     Image,
+    Interpretation,
     Json,
     Label,
     Markdown,
diff --git a/gradio/components.py b/gradio/components.py
--- a/gradio/components.py
+++ b/gradio/components.py
@@ -4015,10 +4015,13 @@ def style(self):
 ############################
 
 
+@document()
 class Dataset(Clickable, Component):
     """
-    Used to create a output widget for showing datasets. Used to render the examples
-    box in the interface.
+    Used to create an output widget for showing datasets. Used to render the examples
+    box.
+    Preprocessing: this component does *not* accept input.
+    Postprocessing: expects a {list} of {lists} corresponding to the dataset data.
     """
 
     def __init__(
@@ -4088,9 +4091,12 @@ def style(
         )
 
 
+@document()
 class Interpretation(Component):
     """
     Used to create an interpretation widget for a component.
+    Preprocessing: this component does *not* accept input.
+    Postprocessing: expects a {dict} with keys "original" and "interpretation".
     """
 
     def __init__(
@@ -4101,6 +4107,12 @@ def __init__(
         elem_id: Optional[str] = None,
         **kwargs,
     ):
+        """
+        Parameters:
+            component: Which component to show in the interpretation widget.
+            visible: Whether or not the interpretation is visible.
+            elem_id: An optional string that is assigned as the id of this component in the HTML DOM. Can be used for targeting CSS styles.
+        """
         Component.__init__(self, visible=visible, elem_id=elem_id, **kwargs)
         self.component = component
 
diff --git a/website/homepage/src/docs/__init__.py b/website/homepage/src/docs/__init__.py
--- a/website/homepage/src/docs/__init__.py
+++ b/website/homepage/src/docs/__init__.py
@@ -56,7 +56,8 @@ def add_supported_events():
             component["events"].append("edit()")
         if issubclass(component["class"], Submittable):
             component["events"].append("submit()")
-        component["events"] = ", ".join(component["events"])
+        if component["events"]:
+            component["events"] = ", ".join(component["events"])
 
 add_supported_events()
 
@@ -79,6 +80,7 @@ def override_signature(name, signature):
 override_signature("Tabs", "with gradio.Tabs():")
 override_signature("Group", "with gradio.Group():")
 override_signature("Box", "with gradio.Box():")
+override_signature("Dataset", "gr.Dataset(components, samples)")
 
 
 def find_cls(target_cls):


Test patch:
Repository: gradio-app/gradio

Issue:
Interface Clear button is broken on spaces
### Describe the bug

The _js parameter does not seem to work on spaces. This means the clear button doesn't work as well.

This is in gradio 3.1.5. I think it was a recent change because that was not the case as of this Monday since this is not the case in the demos deployed for #2012 

This also doesn't happen locally.

### Is there an existing issue for this?

- [X] I have searched the existing issues

### Reproduction

### Clear button working on Monday (PR #2012)
![interface_working_previous](https://user-images.githubusercontent.com/41651716/185654342-16dee169-5bc6-49e8-8208-6b9ca4962afe.gif)

### Clear button broken 3.1.5 (PR #2033)
![interface_broken_3 1 5](https://user-images.githubusercontent.com/41651716/185654456-9c381d33-4cfb-4945-9986-aa0052190051.gif)



### Screenshot

Logs - noticed we log a lot of things to the console?

<img width="679" alt="image" src="https://user-images.githubusercontent.com/41651716/185654861-38131b2f-740e-46da-9e85-37e78782903f.png">


### Logs

```shell
-
```


### System Info

```shell
Spaces
```


### Severity

blocking upgrade to latest gradio version


Discussion:

Resolving patch:
diff --git a/gradio/blocks.py b/gradio/blocks.py
--- a/gradio/blocks.py
+++ b/gradio/blocks.py
@@ -151,7 +151,7 @@ def set_event_trigger(
             "status_tracker": status_tracker._id
             if status_tracker is not None
             else None,
-            "queue": queue,
+            "queue": False if fn is None else queue,
             "api_name": api_name,
             "scroll_to_output": scroll_to_output,
             "show_progress": show_progress,


Test patch: