Upload folder using huggingface_hub (part 9)
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
- .gitattributes +1 -0
- `/Agents/influencer-thread-pipeline/.venv/Lib/site-packages/gradio-6.26.0.dist-info/INSTALLER +1 -0
- `/Agents/influencer-thread-pipeline/.venv/Lib/site-packages/gradio-6.26.0.dist-info/METADATA +284 -0
- `/Agents/influencer-thread-pipeline/.venv/Lib/site-packages/gradio-6.26.0.dist-info/RECORD +0 -0
- `/Agents/influencer-thread-pipeline/.venv/Lib/site-packages/gradio-6.26.0.dist-info/REQUESTED +0 -0
- `/Agents/influencer-thread-pipeline/.venv/Lib/site-packages/gradio-6.26.0.dist-info/WHEEL +4 -0
- `/Agents/influencer-thread-pipeline/.venv/Lib/site-packages/gradio-6.26.0.dist-info/entry_points.txt +3 -0
- `/Agents/influencer-thread-pipeline/.venv/Lib/site-packages/gradio-6.26.0.dist-info/licenses/LICENSE +201 -0
- `/Agents/influencer-thread-pipeline/.venv/Lib/site-packages/gradio/templates.py +847 -0
- `/Agents/influencer-thread-pipeline/.venv/Lib/site-packages/gradio/templates.pyi +898 -0
- `/Agents/influencer-thread-pipeline/.venv/Lib/site-packages/gradio/templates/node/build/node_modules/follow-redirects/LICENSE +18 -0
- `/Agents/influencer-thread-pipeline/.venv/Lib/site-packages/gradio/templates/node/build/node_modules/follow-redirects/README.md +157 -0
- `/Agents/influencer-thread-pipeline/.venv/Lib/site-packages/gradio/templates/node/build/node_modules/follow-redirects/package.json +58 -0
- `/Agents/influencer-thread-pipeline/.venv/Lib/site-packages/gradio/templates/node/build/node_modules/http-proxy/.auto-changelog +6 -0
- `/Agents/influencer-thread-pipeline/.venv/Lib/site-packages/gradio/templates/node/build/node_modules/http-proxy/.gitattributes +1 -0
- `/Agents/influencer-thread-pipeline/.venv/Lib/site-packages/gradio/templates/node/build/node_modules/http-proxy/CHANGELOG.md +0 -0
- `/Agents/influencer-thread-pipeline/.venv/Lib/site-packages/gradio/templates/node/build/node_modules/http-proxy/CODE_OF_CONDUCT.md +74 -0
- `/Agents/influencer-thread-pipeline/.venv/Lib/site-packages/gradio/templates/node/build/node_modules/http-proxy/LICENSE +23 -0
- `/Agents/influencer-thread-pipeline/.venv/Lib/site-packages/gradio/templates/node/build/node_modules/http-proxy/README.md +568 -0
- `/Agents/influencer-thread-pipeline/.venv/Lib/site-packages/gradio/templates/node/build/node_modules/http-proxy/codecov.yml +10 -0
- `/Agents/influencer-thread-pipeline/.venv/Lib/site-packages/gradio/templates/node/build/node_modules/http-proxy/index.js +13 -0
- `/Agents/influencer-thread-pipeline/.venv/Lib/site-packages/gradio/templates/node/build/node_modules/http-proxy/lib/http-proxy.js +66 -0
- `/Agents/influencer-thread-pipeline/.venv/Lib/site-packages/gradio/templates/node/build/node_modules/http-proxy/lib/http-proxy/common.js +248 -0
- `/Agents/influencer-thread-pipeline/.venv/Lib/site-packages/gradio/templates/node/build/node_modules/http-proxy/lib/http-proxy/index.js +185 -0
- `/Agents/influencer-thread-pipeline/.venv/Lib/site-packages/gradio/templates/node/build/node_modules/http-proxy/lib/http-proxy/passes/web-incoming.js +194 -0
- `/Agents/influencer-thread-pipeline/.venv/Lib/site-packages/gradio/templates/node/build/node_modules/http-proxy/lib/http-proxy/passes/web-outgoing.js +147 -0
- `/Agents/influencer-thread-pipeline/.venv/Lib/site-packages/gradio/templates/node/build/node_modules/http-proxy/lib/http-proxy/passes/ws-incoming.js +162 -0
- `/Agents/influencer-thread-pipeline/.venv/Lib/site-packages/gradio/templates/node/build/node_modules/http-proxy/package.json +41 -0
- `/Agents/influencer-thread-pipeline/.venv/Lib/site-packages/gradio/templates/node/build/node_modules/http-proxy/renovate.json +19 -0
- `/Agents/influencer-thread-pipeline/.venv/Lib/site-packages/gradio/templates/node/build/node_modules/requires-port/.npmignore +2 -0
- `/Agents/influencer-thread-pipeline/.venv/Lib/site-packages/gradio/templates/node/build/node_modules/requires-port/.travis.yml +19 -0
- `/Agents/influencer-thread-pipeline/.venv/Lib/site-packages/gradio/templates/node/build/node_modules/requires-port/LICENSE +22 -0
- `/Agents/influencer-thread-pipeline/.venv/Lib/site-packages/gradio/templates/node/build/node_modules/requires-port/README.md +47 -0
- `/Agents/influencer-thread-pipeline/.venv/Lib/site-packages/gradio/templates/node/build/node_modules/requires-port/index.js +38 -0
- `/Agents/influencer-thread-pipeline/.venv/Lib/site-packages/gradio/templates/node/build/node_modules/requires-port/package.json +47 -0
- `/Agents/influencer-thread-pipeline/.venv/Lib/site-packages/gradio/templates/node/build/node_modules/requires-port/test.js +98 -0
- `/Agents/influencer-thread-pipeline/.venv/Lib/site-packages/gradio/templates/node/build/package-lock.json +59 -0
- `/Agents/influencer-thread-pipeline/.venv/Lib/site-packages/gradio/templates/node/build/package.json +7 -0
- `/Agents/influencer-thread-pipeline/.venv/Lib/site-packages/gradio/templates/node/build/proxy_routes.js +133 -0
- `/Agents/influencer-thread-pipeline/.venv/Lib/site-packages/gradio/templates/node/build/server/chunks/0-CSL1qC8W.js +21 -0
- `/Agents/influencer-thread-pipeline/.venv/Lib/site-packages/gradio/templates/node/build/server/chunks/1-Dbm9L0GN.js +9 -0
- `/Agents/influencer-thread-pipeline/.venv/Lib/site-packages/gradio/templates/node/build/server/chunks/2-CQ_Bz8hd.js +0 -0
- `/Agents/influencer-thread-pipeline/.venv/Lib/site-packages/gradio/templates/node/build/server/chunks/Example10-8GKOSZX2.js +7 -0
- `/Agents/influencer-thread-pipeline/.venv/Lib/site-packages/gradio/templates/node/build/server/chunks/Example12-xQwKGIj7.js +7 -0
- `/Agents/influencer-thread-pipeline/.venv/Lib/site-packages/gradio/templates/node/build/server/chunks/Example14-BDt9lUCk.js +7 -0
- `/Agents/influencer-thread-pipeline/.venv/Lib/site-packages/gradio/templates/node/build/server/chunks/Example15-DOVMOMFU.js +7 -0
- `/Agents/influencer-thread-pipeline/.venv/Lib/site-packages/gradio/templates/node/build/server/chunks/Example18-B-up1lL9.js +7 -0
- `/Agents/influencer-thread-pipeline/.venv/Lib/site-packages/gradio/templates/node/build/server/chunks/Example19-C8Rd0OgD.js +7 -0
- `/Agents/influencer-thread-pipeline/.venv/Lib/site-packages/gradio/templates/node/build/server/chunks/Example2-70VzHOK1.js +7 -0
- `/Agents/influencer-thread-pipeline/.venv/Lib/site-packages/gradio/templates/node/build/server/chunks/Example21-DCmcGVAD.js +7 -0
.gitattributes
CHANGED
|
@@ -68,3 +68,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
| 68 |
`/Agents/influencer-thread-pipeline/.venv/Lib/site-packages/gradio/templates/node/build/client/_app/immutable/chunks/CYTxTm2V2.js.br filter=lfs diff=lfs merge=lfs -text
|
| 69 |
`/Agents/influencer-thread-pipeline/.venv/Lib/site-packages/gradio/templates/node/build/client/_app/immutable/chunks/DNekb51P2.js.br filter=lfs diff=lfs merge=lfs -text
|
| 70 |
`/Agents/influencer-thread-pipeline/.venv/Lib/site-packages/gradio/templates/node/build/client/_app/immutable/chunks/DR1dImtM2.js.br filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
| 68 |
`/Agents/influencer-thread-pipeline/.venv/Lib/site-packages/gradio/templates/node/build/client/_app/immutable/chunks/CYTxTm2V2.js.br filter=lfs diff=lfs merge=lfs -text
|
| 69 |
`/Agents/influencer-thread-pipeline/.venv/Lib/site-packages/gradio/templates/node/build/client/_app/immutable/chunks/DNekb51P2.js.br filter=lfs diff=lfs merge=lfs -text
|
| 70 |
`/Agents/influencer-thread-pipeline/.venv/Lib/site-packages/gradio/templates/node/build/client/_app/immutable/chunks/DR1dImtM2.js.br filter=lfs diff=lfs merge=lfs -text
|
| 71 |
+
`/Agents/influencer-thread-pipeline/.venv/Lib/site-packages/hf_xet/hf_xet.pyd filter=lfs diff=lfs merge=lfs -text
|
`/Agents/influencer-thread-pipeline/.venv/Lib/site-packages/gradio-6.26.0.dist-info/INSTALLER
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
pip
|
`/Agents/influencer-thread-pipeline/.venv/Lib/site-packages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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Metadata-Version: 2.4
|
| 2 |
+
Name: gradio
|
| 3 |
+
Version: 6.26.0
|
| 4 |
+
Summary: Python library for easily interacting with trained machine learning models
|
| 5 |
+
Project-URL: Homepage, https://github.com/gradio-app/gradio
|
| 6 |
+
Author-email: Abubakar Abid <gradio-team@huggingface.co>, Ali Abid <gradio-team@huggingface.co>, Ali Abdalla <gradio-team@huggingface.co>, Dawood Khan <gradio-team@huggingface.co>, Ahsen Khaliq <gradio-team@huggingface.co>, Pete Allen <gradio-team@huggingface.co>, Ömer Faruk Özdemir <gradio-team@huggingface.co>, Freddy A Boulton <gradio-team@huggingface.co>, Hannah Blair <gradio-team@huggingface.co>
|
| 7 |
+
License-Expression: Apache-2.0
|
| 8 |
+
License-File: LICENSE
|
| 9 |
+
Keywords: machine learning,reproducibility,visualization
|
| 10 |
+
Classifier: Development Status :: 5 - Production/Stable
|
| 11 |
+
Classifier: Operating System :: OS Independent
|
| 12 |
+
Classifier: Programming Language :: Python :: 3
|
| 13 |
+
Classifier: Programming Language :: Python :: 3 :: Only
|
| 14 |
+
Classifier: Programming Language :: Python :: 3.10
|
| 15 |
+
Classifier: Programming Language :: Python :: 3.11
|
| 16 |
+
Classifier: Programming Language :: Python :: 3.12
|
| 17 |
+
Classifier: Programming Language :: Python :: 3.13
|
| 18 |
+
Classifier: Topic :: Scientific/Engineering
|
| 19 |
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
| 20 |
+
Classifier: Topic :: Scientific/Engineering :: Visualization
|
| 21 |
+
Requires-Python: >=3.10
|
| 22 |
+
Requires-Dist: anyio<5.0,>=3.0
|
| 23 |
+
Requires-Dist: audioop-lts<=0.2.2; python_version >= '3.13'
|
| 24 |
+
Requires-Dist: brotli>=1.1.0
|
| 25 |
+
Requires-Dist: fastapi<1.0,>=0.115.2
|
| 26 |
+
Requires-Dist: gradio-client==2.6.1
|
| 27 |
+
Requires-Dist: groovy~=0.1
|
| 28 |
+
Requires-Dist: hf-gradio<1.0,>=0.4.1
|
| 29 |
+
Requires-Dist: httpx<1.0,>=0.24.1
|
| 30 |
+
Requires-Dist: huggingface-hub<2.0,>=1.16.0
|
| 31 |
+
Requires-Dist: jinja2<4.0
|
| 32 |
+
Requires-Dist: markupsafe<4.0,>=2.0
|
| 33 |
+
Requires-Dist: numpy<3.0,>=1.0
|
| 34 |
+
Requires-Dist: orjson~=3.0
|
| 35 |
+
Requires-Dist: packaging
|
| 36 |
+
Requires-Dist: pandas<4.0,>=1.0
|
| 37 |
+
Requires-Dist: pillow<13.0,>=8.0
|
| 38 |
+
Requires-Dist: pydantic<=3.0,>=2.0
|
| 39 |
+
Requires-Dist: pydub<1.0
|
| 40 |
+
Requires-Dist: python-multipart<1.0,>=0.0.18
|
| 41 |
+
Requires-Dist: pytz>=2017.2
|
| 42 |
+
Requires-Dist: pyyaml<7.0,>=5.0
|
| 43 |
+
Requires-Dist: safehttpx<0.2.0,>=0.1.7
|
| 44 |
+
Requires-Dist: semantic-version~=2.0
|
| 45 |
+
Requires-Dist: starlette<2.0,>=1.0.1
|
| 46 |
+
Requires-Dist: tomlkit<0.15.0,>=0.12.0
|
| 47 |
+
Requires-Dist: typer<1.0,>=0.12
|
| 48 |
+
Requires-Dist: typing-extensions~=4.0
|
| 49 |
+
Requires-Dist: uvicorn>=0.14.0
|
| 50 |
+
Provides-Extra: mcp
|
| 51 |
+
Requires-Dist: mcp<2.0.0,>=1.21.0; extra == 'mcp'
|
| 52 |
+
Requires-Dist: pydantic<=2.12.5,>=2.11.10; extra == 'mcp'
|
| 53 |
+
Provides-Extra: oauth
|
| 54 |
+
Requires-Dist: authlib; extra == 'oauth'
|
| 55 |
+
Requires-Dist: itsdangerous; extra == 'oauth'
|
| 56 |
+
Description-Content-Type: text/markdown
|
| 57 |
+
|
| 58 |
+
<!-- DO NOT EDIT THIS FILE DIRECTLY. INSTEAD EDIT THE `readme_template.md` OR `guides/01_getting-started/01_quickstart.md` TEMPLATES AND THEN RUN `render_readme.py` SCRIPT. -->
|
| 59 |
+
|
| 60 |
+
<div align="center">
|
| 61 |
+
<a href="https://gradio.app">
|
| 62 |
+
<img src="https://raw.githubusercontent.com/gradio-app/gradio/main/readme_files/gradio.svg" alt="gradio" width=350>
|
| 63 |
+
</a>
|
| 64 |
+
</div>
|
| 65 |
+
|
| 66 |
+
<div align="center">
|
| 67 |
+
<span>
|
| 68 |
+
<a href="https://www.producthunt.com/posts/gradio-5-0?embed=true&utm_source=badge-featured&utm_medium=badge&utm_souce=badge-gradio-5-0" target="_blank"><img src="https://api.producthunt.com/widgets/embed-image/v1/featured.svg?post_id=501906&theme=light" alt="Gradio 5.0 - the easiest way to build AI web apps | Product Hunt" style="width: 150px; height: 54px;" width="150" height="54" /></a>
|
| 69 |
+
<a href="https://trendshift.io/repositories/2145" target="_blank"><img src="https://trendshift.io/api/badge/repositories/2145" alt="gradio-app%2Fgradio | Trendshift" style="width: 150px; height: 55px;" width="150" height="55"/></a>
|
| 70 |
+
</span>
|
| 71 |
+
|
| 72 |
+
[](https://github.com/gradio-app/gradio/actions/workflows/test-python.yml)
|
| 73 |
+
[](https://github.com/gradio-app/gradio/actions/workflows/tests-js.yml)
|
| 74 |
+
[](https://pypi.org/project/gradio/)
|
| 75 |
+
[](https://pypi.org/project/gradio/)
|
| 76 |
+

|
| 77 |
+
[](https://twitter.com/gradio)
|
| 78 |
+
|
| 79 |
+
[Website](https://gradio.app)
|
| 80 |
+
| [Documentation](https://gradio.app/docs/)
|
| 81 |
+
| [Guides](https://gradio.app/guides/)
|
| 82 |
+
| [Getting Started](https://gradio.app/getting_started/)
|
| 83 |
+
| [Examples](demo/)
|
| 84 |
+
|
| 85 |
+
</div>
|
| 86 |
+
|
| 87 |
+
<div align="center">
|
| 88 |
+
|
| 89 |
+
English | [中文](https://raw.githubusercontent.com/gradio-app/gradio/main/readme_files/zh-cn#readme)
|
| 90 |
+
|
| 91 |
+
</div>
|
| 92 |
+
|
| 93 |
+
# Gradio: Build Machine Learning Web Apps — in Python
|
| 94 |
+
|
| 95 |
+
|
| 96 |
+
|
| 97 |
+
Gradio is an open-source Python package that allows you to quickly **build** a demo or web application for your machine learning model, API, or any arbitrary Python function. You can then **share** a link to your demo or web application in just a few seconds using Gradio's built-in sharing features. *No JavaScript, CSS, or web hosting experience needed!*
|
| 98 |
+
|
| 99 |
+
<img src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/gradio-guides/gif-version.gif" style="padding-bottom: 10px">
|
| 100 |
+
|
| 101 |
+
It just takes a few lines of Python to create your own demo, so let's get started 💫
|
| 102 |
+
|
| 103 |
+
|
| 104 |
+
### Installation
|
| 105 |
+
|
| 106 |
+
**Prerequisite**: Gradio requires [Python 3.10 or higher](https://www.python.org/downloads/).
|
| 107 |
+
|
| 108 |
+
|
| 109 |
+
We recommend installing Gradio using `pip`, which is included by default in Python. Run this in your terminal or command prompt:
|
| 110 |
+
|
| 111 |
+
```bash
|
| 112 |
+
pip install --upgrade gradio
|
| 113 |
+
```
|
| 114 |
+
|
| 115 |
+
|
| 116 |
+
> [!TIP]
|
| 117 |
+
> It is best to install Gradio in a virtual environment. Detailed installation instructions for all common operating systems <a href="https://www.gradio.app/main/guides/installing-gradio-in-a-virtual-environment">are provided here</a>.
|
| 118 |
+
|
| 119 |
+
### Building Your First Demo
|
| 120 |
+
|
| 121 |
+
You can run Gradio in your favorite code editor, Jupyter notebook, Google Colab, or anywhere else you write Python. Let's write your first Gradio app:
|
| 122 |
+
|
| 123 |
+
|
| 124 |
+
```python
|
| 125 |
+
import gradio as gr
|
| 126 |
+
|
| 127 |
+
def greet(name, intensity):
|
| 128 |
+
return "Hello, " + name + "!" * int(intensity)
|
| 129 |
+
|
| 130 |
+
demo = gr.Interface(
|
| 131 |
+
fn=greet,
|
| 132 |
+
inputs=["text", "slider"],
|
| 133 |
+
outputs=["text"],
|
| 134 |
+
api_name="predict"
|
| 135 |
+
)
|
| 136 |
+
|
| 137 |
+
demo.launch()
|
| 138 |
+
```
|
| 139 |
+
|
| 140 |
+
|
| 141 |
+
|
| 142 |
+
> [!TIP]
|
| 143 |
+
> We shorten the imported name from <code>gradio</code> to <code>gr</code>. This is a widely adopted convention for better readability of code.
|
| 144 |
+
|
| 145 |
+
Now, run your code. If you've written the Python code in a file named `app.py`, then you would run `python app.py` from the terminal.
|
| 146 |
+
|
| 147 |
+
The demo below will open in a browser on [http://localhost:7860](http://localhost:7860) if running from a file. If you are running within a notebook, the demo will appear embedded within the notebook.
|
| 148 |
+
|
| 149 |
+

|
| 150 |
+
|
| 151 |
+
Type your name in the textbox on the left, drag the slider, and then press the Submit button. You should see a friendly greeting on the right.
|
| 152 |
+
|
| 153 |
+
> [!TIP]
|
| 154 |
+
> When developing locally, you can run your Gradio app in <strong>hot reload mode</strong>, which automatically reloads the Gradio app whenever you make changes to the file. To do this, simply type in <code>gradio</code> before the name of the file instead of <code>python</code>. In the example above, you would type: `gradio app.py` in your terminal. You can also enable <strong>vibe mode</strong> by using the <code>--vibe</code> flag, e.g. <code>gradio --vibe app.py</code>, which provides an in-browser chat that can be used to write or edit your Gradio app using natural language. Learn more in the <a href="https://www.gradio.app/guides/developing-faster-with-reload-mode">Hot Reloading Guide</a>.
|
| 155 |
+
|
| 156 |
+
|
| 157 |
+
**Understanding the `Interface` Class**
|
| 158 |
+
|
| 159 |
+
You'll notice that in order to make your first demo, you created an instance of the `gr.Interface` class. The `Interface` class is designed to create demos for machine learning models which accept one or more inputs, and return one or more outputs.
|
| 160 |
+
|
| 161 |
+
The `Interface` class has three core arguments:
|
| 162 |
+
|
| 163 |
+
- `fn`: the function to wrap a user interface (UI) around
|
| 164 |
+
- `inputs`: the Gradio component(s) to use for the input. The number of components should match the number of arguments in your function.
|
| 165 |
+
- `outputs`: the Gradio component(s) to use for the output. The number of components should match the number of return values from your function.
|
| 166 |
+
|
| 167 |
+
The `fn` argument is very flexible -- you can pass *any* Python function that you want to wrap with a UI. In the example above, we saw a relatively simple function, but the function could be anything from a music generator to a tax calculator to the prediction function of a pretrained machine learning model.
|
| 168 |
+
|
| 169 |
+
The `inputs` and `outputs` arguments take one or more Gradio components. As we'll see, Gradio includes more than [30 built-in components](https://www.gradio.app/docs/gradio/introduction) (such as the `gr.Textbox()`, `gr.Image()`, and `gr.HTML()` components) that are designed for machine learning applications.
|
| 170 |
+
|
| 171 |
+
> [!TIP]
|
| 172 |
+
> For the `inputs` and `outputs` arguments, you can pass in the name of these components as a string (`"textbox"`) or an instance of the class (`gr.Textbox()`).
|
| 173 |
+
|
| 174 |
+
If your function accepts more than one argument, as is the case above, pass a list of input components to `inputs`, with each input component corresponding to one of the arguments of the function, in order. The same holds true if your function returns more than one value: simply pass in a list of components to `outputs`. This flexibility makes the `Interface` class a very powerful way to create demos.
|
| 175 |
+
|
| 176 |
+
We'll dive deeper into the `gr.Interface` on our series on [building Interfaces](https://www.gradio.app/main/guides/the-interface-class).
|
| 177 |
+
|
| 178 |
+
### Sharing Your Demo
|
| 179 |
+
|
| 180 |
+
What good is a beautiful demo if you can't share it? Gradio lets you easily share a machine learning demo without having to worry about the hassle of hosting on a web server. Simply set `share=True` in `launch()`, and a publicly accessible URL will be created for your demo. Let's revisit our example demo, but change the last line as follows:
|
| 181 |
+
|
| 182 |
+
```python
|
| 183 |
+
import gradio as gr
|
| 184 |
+
|
| 185 |
+
def greet(name):
|
| 186 |
+
return "Hello " + name + "!"
|
| 187 |
+
|
| 188 |
+
demo = gr.Interface(fn=greet, inputs="textbox", outputs="textbox")
|
| 189 |
+
|
| 190 |
+
demo.launch(share=True) # Share your demo with just 1 extra parameter 🚀
|
| 191 |
+
```
|
| 192 |
+
|
| 193 |
+
When you run this code, a public URL will be generated for your demo in a matter of seconds, something like:
|
| 194 |
+
|
| 195 |
+
👉 `https://a23dsf231adb.gradio.live`
|
| 196 |
+
|
| 197 |
+
Now, anyone around the world can try your Gradio demo from their browser, while the machine learning model and all computation continues to run locally on your computer.
|
| 198 |
+
|
| 199 |
+
To learn more about sharing your demo, read our dedicated guide on [sharing your Gradio application](https://www.gradio.app/guides/sharing-your-app).
|
| 200 |
+
|
| 201 |
+
|
| 202 |
+
### An Overview of Gradio
|
| 203 |
+
|
| 204 |
+
So far, we've been discussing the `Interface` class, which is a high-level class that lets you build demos quickly with Gradio. But what else does Gradio include?
|
| 205 |
+
|
| 206 |
+
#### Custom Demos with `gr.Blocks`
|
| 207 |
+
|
| 208 |
+
Gradio offers a low-level approach for designing web apps with more customizable layouts and data flows with the `gr.Blocks` class. Blocks supports things like controlling where components appear on the page, handling multiple data flows and more complex interactions (e.g. outputs can serve as inputs to other functions), and updating properties/visibility of components based on user interaction — still all in Python.
|
| 209 |
+
|
| 210 |
+
You can build very custom and complex applications using `gr.Blocks()`. For example, the popular image generation [Automatic1111 Web UI](https://github.com/AUTOMATIC1111/stable-diffusion-webui) is built using Gradio Blocks. We dive deeper into the `gr.Blocks` on our series on [building with Blocks](https://www.gradio.app/guides/blocks-and-event-listeners).
|
| 211 |
+
|
| 212 |
+
#### Chatbots with `gr.ChatInterface`
|
| 213 |
+
|
| 214 |
+
Gradio includes another high-level class, `gr.ChatInterface`, which is specifically designed to create Chatbot UIs. Similar to `Interface`, you supply a function and Gradio creates a fully working Chatbot UI. If you're interested in creating a chatbot, you can jump straight to [our dedicated guide on `gr.ChatInterface`](https://www.gradio.app/guides/creating-a-chatbot-fast).
|
| 215 |
+
|
| 216 |
+
#### The Gradio Python & JavaScript Ecosystem
|
| 217 |
+
|
| 218 |
+
That's the gist of the core `gradio` Python library, but Gradio is actually so much more! It's an entire ecosystem of Python and JavaScript libraries that let you build machine learning applications, or query them programmatically, in Python or JavaScript. Here are other related parts of the Gradio ecosystem:
|
| 219 |
+
|
| 220 |
+
* [Gradio Python Client](https://www.gradio.app/guides/getting-started-with-the-python-client) (`gradio_client`): query any Gradio app programmatically in Python.
|
| 221 |
+
* [Gradio JavaScript Client](https://www.gradio.app/guides/getting-started-with-the-js-client) (`@gradio/client`): query any Gradio app programmatically in JavaScript.
|
| 222 |
+
* [Hugging Face Spaces](https://huggingface.co/spaces): the most popular place to host Gradio applications — for free!
|
| 223 |
+
* [Server mode](https://www.gradio.app/guides/server-mode) (`gradio.Server`): build a custom frontend with Gradio's backend — queue, streaming, MCP, ZeroGPU, and Spaces hosting included.
|
| 224 |
+
|
| 225 |
+
### What's Next?
|
| 226 |
+
|
| 227 |
+
Keep learning about Gradio sequentially using the Gradio Guides, which include explanations as well as example code and embedded interactive demos. Next up: [let's dive deeper into the Interface class](https://www.gradio.app/guides/the-interface-class).
|
| 228 |
+
|
| 229 |
+
Or, if you already know the basics and are looking for something specific, you can search the more [technical API documentation](https://www.gradio.app/docs/).
|
| 230 |
+
|
| 231 |
+
|
| 232 |
+
### AI Coding Skills
|
| 233 |
+
|
| 234 |
+
Gradio provides a "skill" that enriches AI coding assistants (like Cursor, Claude Code, Codex, etc.) with Gradio-specific knowledge, so that they can build Gradio apps more effectively. This is especially useful when creating custom Gradio components or styling. Install the Gradio skill for your coding assistant with a single command:
|
| 235 |
+
|
| 236 |
+
```bash
|
| 237 |
+
gradio skills add --cursor # or --claude, --codex, --opencode
|
| 238 |
+
```
|
| 239 |
+
|
| 240 |
+
Use `--global` to install at the user level (applies to all projects). Your skill will be automatically available for the particular coding agent.
|
| 241 |
+
|
| 242 |
+
You can also install a skill for a **specific Gradio Space**, which generates API usage docs (Python, JS, cURL) on the fly:
|
| 243 |
+
|
| 244 |
+
```bash
|
| 245 |
+
gradio skills add abidlabs/en2fr --cursor
|
| 246 |
+
```
|
| 247 |
+
|
| 248 |
+
## Questions?
|
| 249 |
+
|
| 250 |
+
If you'd like to report a bug or have a feature request, please create an [issue on GitHub](https://github.com/gradio-app/gradio/issues/new/choose). For general questions about usage, we are available on [our Discord server](https://discord.com/invite/feTf9x3ZSB) and happy to help.
|
| 251 |
+
|
| 252 |
+
If you like Gradio, please leave us a ⭐ on GitHub!
|
| 253 |
+
|
| 254 |
+
## Open Source Stack
|
| 255 |
+
|
| 256 |
+
Gradio is built on top of many wonderful open-source libraries!
|
| 257 |
+
|
| 258 |
+
[<img src="https://raw.githubusercontent.com/gradio-app/gradio/main/readme_files/huggingface_mini.svg" alt="huggingface" height=40>](https://huggingface.co)
|
| 259 |
+
[<img src="https://raw.githubusercontent.com/gradio-app/gradio/main/readme_files/python.svg" alt="python" height=40>](https://www.python.org)
|
| 260 |
+
[<img src="https://raw.githubusercontent.com/gradio-app/gradio/main/readme_files/fastapi.svg" alt="fastapi" height=40>](https://fastapi.tiangolo.com)
|
| 261 |
+
[<img src="https://raw.githubusercontent.com/gradio-app/gradio/main/readme_files/encode.svg" alt="encode" height=40>](https://www.encode.io)
|
| 262 |
+
[<img src="https://raw.githubusercontent.com/gradio-app/gradio/main/readme_files/svelte.svg" alt="svelte" height=40>](https://svelte.dev)
|
| 263 |
+
[<img src="https://raw.githubusercontent.com/gradio-app/gradio/main/readme_files/vite.svg" alt="vite" height=40>](https://vitejs.dev)
|
| 264 |
+
[<img src="https://raw.githubusercontent.com/gradio-app/gradio/main/readme_files/pnpm.svg" alt="pnpm" height=40>](https://pnpm.io)
|
| 265 |
+
[<img src="https://raw.githubusercontent.com/gradio-app/gradio/main/readme_files/tailwind.svg" alt="tailwind" height=40>](https://tailwindcss.com)
|
| 266 |
+
[<img src="https://raw.githubusercontent.com/gradio-app/gradio/main/readme_files/storybook.svg" alt="storybook" height=40>](https://storybook.js.org/)
|
| 267 |
+
[<img src="https://raw.githubusercontent.com/gradio-app/gradio/main/readme_files/chromatic.svg" alt="chromatic" height=40>](https://www.chromatic.com/)
|
| 268 |
+
|
| 269 |
+
## License
|
| 270 |
+
|
| 271 |
+
Gradio is licensed under the Apache License 2.0 found in the [LICENSE](LICENSE) file in the root directory of this repository.
|
| 272 |
+
|
| 273 |
+
## Citation
|
| 274 |
+
|
| 275 |
+
Also check out the paper _[Gradio: Hassle-Free Sharing and Testing of ML Models in the Wild](https://arxiv.org/abs/1906.02569), ICML HILL 2019_, and please cite it if you use Gradio in your work.
|
| 276 |
+
|
| 277 |
+
```
|
| 278 |
+
@article{abid2019gradio,
|
| 279 |
+
title = {Gradio: Hassle-Free Sharing and Testing of ML Models in the Wild},
|
| 280 |
+
author = {Abid, Abubakar and Abdalla, Ali and Abid, Ali and Khan, Dawood and Alfozan, Abdulrahman and Zou, James},
|
| 281 |
+
journal = {arXiv preprint arXiv:1906.02569},
|
| 282 |
+
year = {2019},
|
| 283 |
+
}
|
| 284 |
+
```
|
`/Agents/influencer-thread-pipeline/.venv/Lib/site-packages/gradio-6.26.0.dist-info/RECORD
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
`/Agents/influencer-thread-pipeline/.venv/Lib/site-packages/gradio-6.26.0.dist-info/REQUESTED
ADDED
|
File without changes
|
`/Agents/influencer-thread-pipeline/.venv/Lib/site-packages/gradio-6.26.0.dist-info/WHEEL
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Wheel-Version: 1.0
|
| 2 |
+
Generator: hatchling 1.32.0
|
| 3 |
+
Root-Is-Purelib: true
|
| 4 |
+
Tag: py3-none-any
|
`/Agents/influencer-thread-pipeline/.venv/Lib/site-packages/gradio-6.26.0.dist-info/entry_points.txt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
[console_scripts]
|
| 2 |
+
gradio = gradio.cli:cli
|
| 3 |
+
upload_theme = gradio.themes.upload_theme:main
|
`/Agents/influencer-thread-pipeline/.venv/Lib/site-packages/gradio-6.26.0.dist-info/licenses/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Apache License
|
| 2 |
+
Version 2.0, January 2004
|
| 3 |
+
http://www.apache.org/licenses/
|
| 4 |
+
|
| 5 |
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
| 6 |
+
|
| 7 |
+
1. Definitions.
|
| 8 |
+
|
| 9 |
+
"License" shall mean the terms and conditions for use, reproduction,
|
| 10 |
+
and distribution as defined by Sections 1 through 9 of this document.
|
| 11 |
+
|
| 12 |
+
"Licensor" shall mean the copyright owner or entity authorized by
|
| 13 |
+
the copyright owner that is granting the License.
|
| 14 |
+
|
| 15 |
+
"Legal Entity" shall mean the union of the acting entity and all
|
| 16 |
+
other entities that control, are controlled by, or are under common
|
| 17 |
+
control with that entity. For the purposes of this definition,
|
| 18 |
+
"control" means (i) the power, direct or indirect, to cause the
|
| 19 |
+
direction or management of such entity, whether by contract or
|
| 20 |
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
| 21 |
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
| 22 |
+
|
| 23 |
+
"You" (or "Your") shall mean an individual or Legal Entity
|
| 24 |
+
exercising permissions granted by this License.
|
| 25 |
+
|
| 26 |
+
"Source" form shall mean the preferred form for making modifications,
|
| 27 |
+
including but not limited to software source code, documentation
|
| 28 |
+
source, and configuration files.
|
| 29 |
+
|
| 30 |
+
"Object" form shall mean any form resulting from mechanical
|
| 31 |
+
transformation or translation of a Source form, including but
|
| 32 |
+
not limited to compiled object code, generated documentation,
|
| 33 |
+
and conversions to other media types.
|
| 34 |
+
|
| 35 |
+
"Work" shall mean the work of authorship, whether in Source or
|
| 36 |
+
Object form, made available under the License, as indicated by a
|
| 37 |
+
copyright notice that is included in or attached to the work
|
| 38 |
+
(an example is provided in the Appendix below).
|
| 39 |
+
|
| 40 |
+
"Derivative Works" shall mean any work, whether in Source or Object
|
| 41 |
+
form, that is based on (or derived from) the Work and for which the
|
| 42 |
+
editorial revisions, annotations, elaborations, or other modifications
|
| 43 |
+
represent, as a whole, an original work of authorship. For the purposes
|
| 44 |
+
of this License, Derivative Works shall not include works that remain
|
| 45 |
+
separable from, or merely link (or bind by name) to the interfaces of,
|
| 46 |
+
the Work and Derivative Works thereof.
|
| 47 |
+
|
| 48 |
+
"Contribution" shall mean any work of authorship, including
|
| 49 |
+
the original version of the Work and any modifications or additions
|
| 50 |
+
to that Work or Derivative Works thereof, that is intentionally
|
| 51 |
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
| 52 |
+
or by an individual or Legal Entity authorized to submit on behalf of
|
| 53 |
+
the copyright owner. For the purposes of this definition, "submitted"
|
| 54 |
+
means any form of electronic, verbal, or written communication sent
|
| 55 |
+
to the Licensor or its representatives, including but not limited to
|
| 56 |
+
communication on electronic mailing lists, source code control systems,
|
| 57 |
+
and issue tracking systems that are managed by, or on behalf of, the
|
| 58 |
+
Licensor for the purpose of discussing and improving the Work, but
|
| 59 |
+
excluding communication that is conspicuously marked or otherwise
|
| 60 |
+
designated in writing by the copyright owner as "Not a Contribution."
|
| 61 |
+
|
| 62 |
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
| 63 |
+
on behalf of whom a Contribution has been received by Licensor and
|
| 64 |
+
subsequently incorporated within the Work.
|
| 65 |
+
|
| 66 |
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
| 67 |
+
this License, each Contributor hereby grants to You a perpetual,
|
| 68 |
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
| 69 |
+
copyright license to reproduce, prepare Derivative Works of,
|
| 70 |
+
publicly display, publicly perform, sublicense, and distribute the
|
| 71 |
+
Work and such Derivative Works in Source or Object form.
|
| 72 |
+
|
| 73 |
+
3. Grant of Patent License. Subject to the terms and conditions of
|
| 74 |
+
this License, each Contributor hereby grants to You a perpetual,
|
| 75 |
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
| 76 |
+
(except as stated in this section) patent license to make, have made,
|
| 77 |
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
| 78 |
+
where such license applies only to those patent claims licensable
|
| 79 |
+
by such Contributor that are necessarily infringed by their
|
| 80 |
+
Contribution(s) alone or by combination of their Contribution(s)
|
| 81 |
+
with the Work to which such Contribution(s) was submitted. If You
|
| 82 |
+
institute patent litigation against any entity (including a
|
| 83 |
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
| 84 |
+
or a Contribution incorporated within the Work constitutes direct
|
| 85 |
+
or contributory patent infringement, then any patent licenses
|
| 86 |
+
granted to You under this License for that Work shall terminate
|
| 87 |
+
as of the date such litigation is filed.
|
| 88 |
+
|
| 89 |
+
4. Redistribution. You may reproduce and distribute copies of the
|
| 90 |
+
Work or Derivative Works thereof in any medium, with or without
|
| 91 |
+
modifications, and in Source or Object form, provided that You
|
| 92 |
+
meet the following conditions:
|
| 93 |
+
|
| 94 |
+
(a) You must give any other recipients of the Work or
|
| 95 |
+
Derivative Works a copy of this License; and
|
| 96 |
+
|
| 97 |
+
(b) You must cause any modified files to carry prominent notices
|
| 98 |
+
stating that You changed the files; and
|
| 99 |
+
|
| 100 |
+
(c) You must retain, in the Source form of any Derivative Works
|
| 101 |
+
that You distribute, all copyright, patent, trademark, and
|
| 102 |
+
attribution notices from the Source form of the Work,
|
| 103 |
+
excluding those notices that do not pertain to any part of
|
| 104 |
+
the Derivative Works; and
|
| 105 |
+
|
| 106 |
+
(d) If the Work includes a "NOTICE" text file as part of its
|
| 107 |
+
distribution, then any Derivative Works that You distribute must
|
| 108 |
+
include a readable copy of the attribution notices contained
|
| 109 |
+
within such NOTICE file, excluding those notices that do not
|
| 110 |
+
pertain to any part of the Derivative Works, in at least one
|
| 111 |
+
of the following places: within a NOTICE text file distributed
|
| 112 |
+
as part of the Derivative Works; within the Source form or
|
| 113 |
+
documentation, if provided along with the Derivative Works; or,
|
| 114 |
+
within a display generated by the Derivative Works, if and
|
| 115 |
+
wherever such third-party notices normally appear. The contents
|
| 116 |
+
of the NOTICE file are for informational purposes only and
|
| 117 |
+
do not modify the License. You may add Your own attribution
|
| 118 |
+
notices within Derivative Works that You distribute, alongside
|
| 119 |
+
or as an addendum to the NOTICE text from the Work, provided
|
| 120 |
+
that such additional attribution notices cannot be construed
|
| 121 |
+
as modifying the License.
|
| 122 |
+
|
| 123 |
+
You may add Your own copyright statement to Your modifications and
|
| 124 |
+
may provide additional or different license terms and conditions
|
| 125 |
+
for use, reproduction, or distribution of Your modifications, or
|
| 126 |
+
for any such Derivative Works as a whole, provided Your use,
|
| 127 |
+
reproduction, and distribution of the Work otherwise complies with
|
| 128 |
+
the conditions stated in this License.
|
| 129 |
+
|
| 130 |
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
| 131 |
+
any Contribution intentionally submitted for inclusion in the Work
|
| 132 |
+
by You to the Licensor shall be under the terms and conditions of
|
| 133 |
+
this License, without any additional terms or conditions.
|
| 134 |
+
Notwithstanding the above, nothing herein shall supersede or modify
|
| 135 |
+
the terms of any separate license agreement you may have executed
|
| 136 |
+
with Licensor regarding such Contributions.
|
| 137 |
+
|
| 138 |
+
6. Trademarks. This License does not grant permission to use the trade
|
| 139 |
+
names, trademarks, service marks, or product names of the Licensor,
|
| 140 |
+
except as required for reasonable and customary use in describing the
|
| 141 |
+
origin of the Work and reproducing the content of the NOTICE file.
|
| 142 |
+
|
| 143 |
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
| 144 |
+
agreed to in writing, Licensor provides the Work (and each
|
| 145 |
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
| 146 |
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
| 147 |
+
implied, including, without limitation, any warranties or conditions
|
| 148 |
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
| 149 |
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
| 150 |
+
appropriateness of using or redistributing the Work and assume any
|
| 151 |
+
risks associated with Your exercise of permissions under this License.
|
| 152 |
+
|
| 153 |
+
8. Limitation of Liability. In no event and under no legal theory,
|
| 154 |
+
whether in tort (including negligence), contract, or otherwise,
|
| 155 |
+
unless required by applicable law (such as deliberate and grossly
|
| 156 |
+
negligent acts) or agreed to in writing, shall any Contributor be
|
| 157 |
+
liable to You for damages, including any direct, indirect, special,
|
| 158 |
+
incidental, or consequential damages of any character arising as a
|
| 159 |
+
result of this License or out of the use or inability to use the
|
| 160 |
+
Work (including but not limited to damages for loss of goodwill,
|
| 161 |
+
work stoppage, computer failure or malfunction, or any and all
|
| 162 |
+
other commercial damages or losses), even if such Contributor
|
| 163 |
+
has been advised of the possibility of such damages.
|
| 164 |
+
|
| 165 |
+
9. Accepting Warranty or Additional Liability. While redistributing
|
| 166 |
+
the Work or Derivative Works thereof, You may choose to offer,
|
| 167 |
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
| 168 |
+
or other liability obligations and/or rights consistent with this
|
| 169 |
+
License. However, in accepting such obligations, You may act only
|
| 170 |
+
on Your own behalf and on Your sole responsibility, not on behalf
|
| 171 |
+
of any other Contributor, and only if You agree to indemnify,
|
| 172 |
+
defend, and hold each Contributor harmless for any liability
|
| 173 |
+
incurred by, or claims asserted against, such Contributor by reason
|
| 174 |
+
of your accepting any such warranty or additional liability.
|
| 175 |
+
|
| 176 |
+
END OF TERMS AND CONDITIONS
|
| 177 |
+
|
| 178 |
+
APPENDIX: How to apply the Apache License to your work.
|
| 179 |
+
|
| 180 |
+
To apply the Apache License to your work, attach the following
|
| 181 |
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
| 182 |
+
replaced with your own identifying information. (Don't include
|
| 183 |
+
the brackets!) The text should be enclosed in the appropriate
|
| 184 |
+
comment syntax for the file format. We also recommend that a
|
| 185 |
+
file or class name and description of purpose be included on the
|
| 186 |
+
same "printed page" as the copyright notice for easier
|
| 187 |
+
identification within third-party archives.
|
| 188 |
+
|
| 189 |
+
Copyright [yyyy] [name of copyright owner]
|
| 190 |
+
|
| 191 |
+
Licensed under the Apache License, Version 2.0 (the "License");
|
| 192 |
+
you may not use this file except in compliance with the License.
|
| 193 |
+
You may obtain a copy of the License at
|
| 194 |
+
|
| 195 |
+
http://www.apache.org/licenses/LICENSE-2.0
|
| 196 |
+
|
| 197 |
+
Unless required by applicable law or agreed to in writing, software
|
| 198 |
+
distributed under the License is distributed on an "AS IS" BASIS,
|
| 199 |
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 200 |
+
See the License for the specific language governing permissions and
|
| 201 |
+
limitations under the License.
|
`/Agents/influencer-thread-pipeline/.venv/Lib/site-packages/gradio/templates.py
ADDED
|
@@ -0,0 +1,847 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
from pathlib import Path
|
| 5 |
+
from typing import TYPE_CHECKING, Any, Literal
|
| 6 |
+
|
| 7 |
+
import numpy as np
|
| 8 |
+
import PIL.Image
|
| 9 |
+
|
| 10 |
+
from gradio import components
|
| 11 |
+
from gradio.components.audio import WaveformOptions
|
| 12 |
+
from gradio.components.image_editor import Brush, Eraser, LayerOptions, WebcamOptions
|
| 13 |
+
from gradio.components.textbox import InputHTMLAttributes
|
| 14 |
+
from gradio.i18n import I18nData
|
| 15 |
+
|
| 16 |
+
if TYPE_CHECKING:
|
| 17 |
+
from gradio.components import Timer
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
class TextArea(components.Textbox):
|
| 21 |
+
"""
|
| 22 |
+
Sets: lines=7
|
| 23 |
+
"""
|
| 24 |
+
|
| 25 |
+
is_template = True
|
| 26 |
+
|
| 27 |
+
def __init__(
|
| 28 |
+
self,
|
| 29 |
+
value: str | Callable | None = None,
|
| 30 |
+
*,
|
| 31 |
+
lines: int = 7,
|
| 32 |
+
max_lines: int = 20,
|
| 33 |
+
placeholder: str | None = None,
|
| 34 |
+
label: str | I18nData | None = None,
|
| 35 |
+
info: str | I18nData | None = None,
|
| 36 |
+
every: Timer | float | None = None,
|
| 37 |
+
inputs: (
|
| 38 |
+
components.Component
|
| 39 |
+
| Sequence[components.Component]
|
| 40 |
+
| set[components.Component]
|
| 41 |
+
| None
|
| 42 |
+
) = None,
|
| 43 |
+
show_label: bool | None = None,
|
| 44 |
+
container: bool = True,
|
| 45 |
+
scale: int | None = None,
|
| 46 |
+
min_width: int = 160,
|
| 47 |
+
interactive: bool | None = None,
|
| 48 |
+
visible: bool | Literal["hidden"] | Literal["hidden"] = True,
|
| 49 |
+
elem_id: str | None = None,
|
| 50 |
+
autofocus: bool = False,
|
| 51 |
+
autoscroll: bool = True,
|
| 52 |
+
elem_classes: list[str] | str | None = None,
|
| 53 |
+
render: bool = True,
|
| 54 |
+
key: int | str | tuple[int | str, ...] | None = None,
|
| 55 |
+
preserved_by_key: list[str] | str | None = "value",
|
| 56 |
+
type: Literal["text", "password", "email"] = "text",
|
| 57 |
+
text_align: Literal["left", "right"] | None = None,
|
| 58 |
+
rtl: bool = False,
|
| 59 |
+
buttons: list[Literal["fullscreen", "copy"]] | None = None,
|
| 60 |
+
max_length: int | None = None,
|
| 61 |
+
submit_btn: str | bool | None = False,
|
| 62 |
+
stop_btn: str | bool | None = False,
|
| 63 |
+
html_attributes: InputHTMLAttributes | None = None,
|
| 64 |
+
):
|
| 65 |
+
super().__init__(
|
| 66 |
+
value=value,
|
| 67 |
+
lines=lines,
|
| 68 |
+
max_lines=max_lines,
|
| 69 |
+
placeholder=placeholder,
|
| 70 |
+
label=label,
|
| 71 |
+
info=info,
|
| 72 |
+
every=every,
|
| 73 |
+
inputs=inputs,
|
| 74 |
+
show_label=show_label,
|
| 75 |
+
container=container,
|
| 76 |
+
scale=scale,
|
| 77 |
+
min_width=min_width,
|
| 78 |
+
interactive=interactive,
|
| 79 |
+
visible=visible,
|
| 80 |
+
elem_id=elem_id,
|
| 81 |
+
autofocus=autofocus,
|
| 82 |
+
autoscroll=autoscroll,
|
| 83 |
+
elem_classes=elem_classes,
|
| 84 |
+
render=render,
|
| 85 |
+
key=key,
|
| 86 |
+
preserved_by_key=preserved_by_key,
|
| 87 |
+
type=type,
|
| 88 |
+
text_align=text_align,
|
| 89 |
+
rtl=rtl,
|
| 90 |
+
buttons=buttons, # type: ignore
|
| 91 |
+
max_length=max_length,
|
| 92 |
+
submit_btn=submit_btn,
|
| 93 |
+
stop_btn=stop_btn,
|
| 94 |
+
html_attributes=html_attributes,
|
| 95 |
+
)
|
| 96 |
+
|
| 97 |
+
|
| 98 |
+
class Sketchpad(components.ImageEditor):
|
| 99 |
+
"""
|
| 100 |
+
Sets: sources=(), brush=Brush(colors=["#000000"], color_mode="fixed")
|
| 101 |
+
"""
|
| 102 |
+
|
| 103 |
+
is_template = True
|
| 104 |
+
|
| 105 |
+
def __init__(
|
| 106 |
+
self,
|
| 107 |
+
value: str | PIL.Image.Image | np.ndarray | None = None,
|
| 108 |
+
*,
|
| 109 |
+
height: int | str | None = None,
|
| 110 |
+
width: int | str | None = None,
|
| 111 |
+
image_mode: Literal[
|
| 112 |
+
"1", "L", "P", "RGB", "RGBA", "CMYK", "YCbCr", "LAB", "HSV", "I", "F"
|
| 113 |
+
] = "RGBA",
|
| 114 |
+
sources: Iterable[Literal["upload", "webcam", "clipboard"]] = (),
|
| 115 |
+
type: Literal["numpy", "pil", "filepath"] = "numpy",
|
| 116 |
+
label: str | I18nData | None = None,
|
| 117 |
+
every: Timer | float | None = None,
|
| 118 |
+
inputs: (
|
| 119 |
+
components.Component
|
| 120 |
+
| Sequence[components.Component]
|
| 121 |
+
| set[components.Component]
|
| 122 |
+
| None
|
| 123 |
+
) = None,
|
| 124 |
+
show_label: bool | None = None,
|
| 125 |
+
buttons: list[Literal["download", "share", "fullscreen"]] | None = None,
|
| 126 |
+
container: bool = True,
|
| 127 |
+
scale: int | None = None,
|
| 128 |
+
min_width: int = 160,
|
| 129 |
+
interactive: bool | None = None,
|
| 130 |
+
visible: bool | Literal["hidden"] = True,
|
| 131 |
+
elem_id: str | None = None,
|
| 132 |
+
elem_classes: list[str] | str | None = None,
|
| 133 |
+
render: bool = True,
|
| 134 |
+
key: int | str | tuple[int | str, ...] | None = None,
|
| 135 |
+
preserved_by_key: list[str] | str | None = "value",
|
| 136 |
+
placeholder: str | None = None,
|
| 137 |
+
webcam_options: WebcamOptions | None = None,
|
| 138 |
+
_selectable: bool = False,
|
| 139 |
+
transforms: Iterable[Literal["crop"]] = ("crop",),
|
| 140 |
+
eraser: Eraser | None = None,
|
| 141 |
+
brush: Brush | None = None,
|
| 142 |
+
format: str = "webp",
|
| 143 |
+
canvas_size: tuple[int, int] = (800, 800),
|
| 144 |
+
fixed_canvas: bool = False,
|
| 145 |
+
layers: LayerOptions | bool = True,
|
| 146 |
+
):
|
| 147 |
+
if not brush:
|
| 148 |
+
brush = Brush(colors=["#000000"], color_mode="fixed")
|
| 149 |
+
super().__init__(
|
| 150 |
+
value=value,
|
| 151 |
+
height=height,
|
| 152 |
+
width=width,
|
| 153 |
+
image_mode=image_mode,
|
| 154 |
+
sources=sources,
|
| 155 |
+
type=type,
|
| 156 |
+
label=label,
|
| 157 |
+
every=every,
|
| 158 |
+
inputs=inputs,
|
| 159 |
+
show_label=show_label,
|
| 160 |
+
buttons=buttons, # type: ignore
|
| 161 |
+
container=container,
|
| 162 |
+
scale=scale,
|
| 163 |
+
min_width=min_width,
|
| 164 |
+
interactive=interactive,
|
| 165 |
+
visible=visible,
|
| 166 |
+
elem_id=elem_id,
|
| 167 |
+
elem_classes=elem_classes,
|
| 168 |
+
render=render,
|
| 169 |
+
key=key,
|
| 170 |
+
preserved_by_key=preserved_by_key,
|
| 171 |
+
placeholder=placeholder,
|
| 172 |
+
webcam_options=webcam_options,
|
| 173 |
+
_selectable=_selectable,
|
| 174 |
+
transforms=transforms,
|
| 175 |
+
eraser=eraser,
|
| 176 |
+
brush=brush,
|
| 177 |
+
format=format,
|
| 178 |
+
layers=layers,
|
| 179 |
+
canvas_size=canvas_size,
|
| 180 |
+
fixed_canvas=fixed_canvas,
|
| 181 |
+
)
|
| 182 |
+
|
| 183 |
+
|
| 184 |
+
class Paint(components.ImageEditor):
|
| 185 |
+
"""
|
| 186 |
+
Sets: sources=()
|
| 187 |
+
"""
|
| 188 |
+
|
| 189 |
+
is_template = True
|
| 190 |
+
|
| 191 |
+
def __init__(
|
| 192 |
+
self,
|
| 193 |
+
value: str | PIL.Image.Image | np.ndarray | None = None,
|
| 194 |
+
*,
|
| 195 |
+
height: int | str | None = None,
|
| 196 |
+
width: int | str | None = None,
|
| 197 |
+
image_mode: Literal[
|
| 198 |
+
"1", "L", "P", "RGB", "RGBA", "CMYK", "YCbCr", "LAB", "HSV", "I", "F"
|
| 199 |
+
] = "RGBA",
|
| 200 |
+
sources: Iterable[Literal["upload", "webcam", "clipboard"]] = (),
|
| 201 |
+
type: Literal["numpy", "pil", "filepath"] = "numpy",
|
| 202 |
+
label: str | I18nData | None = None,
|
| 203 |
+
every: Timer | float | None = None,
|
| 204 |
+
inputs: (
|
| 205 |
+
components.Component
|
| 206 |
+
| Sequence[components.Component]
|
| 207 |
+
| set[components.Component]
|
| 208 |
+
| None
|
| 209 |
+
) = None,
|
| 210 |
+
show_label: bool | None = None,
|
| 211 |
+
buttons: list[Literal["download", "share", "fullscreen"]] | None = None,
|
| 212 |
+
container: bool = True,
|
| 213 |
+
scale: int | None = None,
|
| 214 |
+
min_width: int = 160,
|
| 215 |
+
interactive: bool | None = None,
|
| 216 |
+
visible: bool | Literal["hidden"] = True,
|
| 217 |
+
elem_id: str | None = None,
|
| 218 |
+
elem_classes: list[str] | str | None = None,
|
| 219 |
+
render: bool = True,
|
| 220 |
+
key: int | str | tuple[int | str, ...] | None = None,
|
| 221 |
+
preserved_by_key: list[str] | str | None = "value",
|
| 222 |
+
webcam_options: WebcamOptions | None = None,
|
| 223 |
+
_selectable: bool = False,
|
| 224 |
+
transforms: Iterable[Literal["crop"]] = ("crop",),
|
| 225 |
+
eraser: Eraser | None = None,
|
| 226 |
+
brush: Brush | None = None,
|
| 227 |
+
format: str = "webp",
|
| 228 |
+
layers: LayerOptions | bool = True,
|
| 229 |
+
canvas_size: tuple[int, int] = (800, 800),
|
| 230 |
+
fixed_canvas: bool = False,
|
| 231 |
+
placeholder: str | None = None,
|
| 232 |
+
):
|
| 233 |
+
super().__init__(
|
| 234 |
+
value=value,
|
| 235 |
+
height=height,
|
| 236 |
+
width=width,
|
| 237 |
+
image_mode=image_mode,
|
| 238 |
+
sources=sources,
|
| 239 |
+
type=type,
|
| 240 |
+
label=label,
|
| 241 |
+
every=every,
|
| 242 |
+
inputs=inputs,
|
| 243 |
+
show_label=show_label,
|
| 244 |
+
buttons=buttons, # type: ignore
|
| 245 |
+
container=container,
|
| 246 |
+
scale=scale,
|
| 247 |
+
min_width=min_width,
|
| 248 |
+
interactive=interactive,
|
| 249 |
+
visible=visible,
|
| 250 |
+
elem_id=elem_id,
|
| 251 |
+
elem_classes=elem_classes,
|
| 252 |
+
render=render,
|
| 253 |
+
key=key,
|
| 254 |
+
preserved_by_key=preserved_by_key,
|
| 255 |
+
webcam_options=webcam_options,
|
| 256 |
+
_selectable=_selectable,
|
| 257 |
+
transforms=transforms,
|
| 258 |
+
eraser=eraser,
|
| 259 |
+
brush=brush,
|
| 260 |
+
format=format,
|
| 261 |
+
layers=layers,
|
| 262 |
+
canvas_size=canvas_size,
|
| 263 |
+
placeholder=placeholder,
|
| 264 |
+
fixed_canvas=fixed_canvas,
|
| 265 |
+
)
|
| 266 |
+
|
| 267 |
+
|
| 268 |
+
class ImageMask(components.ImageEditor):
|
| 269 |
+
"""
|
| 270 |
+
Sets: brush=Brush(colors=["#000000"], color_mode="fixed")
|
| 271 |
+
"""
|
| 272 |
+
|
| 273 |
+
is_template = True
|
| 274 |
+
|
| 275 |
+
def __init__(
|
| 276 |
+
self,
|
| 277 |
+
value: str | PIL.Image.Image | np.ndarray | None = None,
|
| 278 |
+
*,
|
| 279 |
+
height: int | str | None = None,
|
| 280 |
+
width: int | str | None = None,
|
| 281 |
+
image_mode: Literal[
|
| 282 |
+
"1", "L", "P", "RGB", "RGBA", "CMYK", "YCbCr", "LAB", "HSV", "I", "F"
|
| 283 |
+
] = "RGBA",
|
| 284 |
+
sources: Iterable[Literal["upload", "webcam", "clipboard"]] = (
|
| 285 |
+
"upload",
|
| 286 |
+
"webcam",
|
| 287 |
+
"clipboard",
|
| 288 |
+
),
|
| 289 |
+
type: Literal["numpy", "pil", "filepath"] = "numpy",
|
| 290 |
+
label: str | I18nData | None = None,
|
| 291 |
+
every: Timer | float | None = None,
|
| 292 |
+
inputs: (
|
| 293 |
+
components.Component
|
| 294 |
+
| Sequence[components.Component]
|
| 295 |
+
| set[components.Component]
|
| 296 |
+
| None
|
| 297 |
+
) = None,
|
| 298 |
+
show_label: bool | None = None,
|
| 299 |
+
buttons: list[Literal["download", "share", "fullscreen"]] | None = None,
|
| 300 |
+
container: bool = True,
|
| 301 |
+
scale: int | None = None,
|
| 302 |
+
min_width: int = 160,
|
| 303 |
+
interactive: bool | None = None,
|
| 304 |
+
visible: bool | Literal["hidden"] = True,
|
| 305 |
+
elem_id: str | None = None,
|
| 306 |
+
elem_classes: list[str] | str | None = None,
|
| 307 |
+
render: bool = True,
|
| 308 |
+
key: int | str | tuple[int | str, ...] | None = None,
|
| 309 |
+
preserved_by_key: list[str] | str | None = "value",
|
| 310 |
+
placeholder: str | None = None,
|
| 311 |
+
_selectable: bool = False,
|
| 312 |
+
transforms: Iterable[Literal["crop"]] = ("crop",),
|
| 313 |
+
eraser: Eraser | None = None,
|
| 314 |
+
brush: Brush | None = None,
|
| 315 |
+
format: str = "webp",
|
| 316 |
+
layers: LayerOptions | bool = False,
|
| 317 |
+
canvas_size: tuple[int, int] = (800, 800),
|
| 318 |
+
fixed_canvas: bool = False,
|
| 319 |
+
webcam_options: WebcamOptions | None = None,
|
| 320 |
+
):
|
| 321 |
+
if not brush:
|
| 322 |
+
brush = Brush(colors=["#000000"], color_mode="fixed")
|
| 323 |
+
super().__init__(
|
| 324 |
+
value=value,
|
| 325 |
+
height=height,
|
| 326 |
+
width=width,
|
| 327 |
+
image_mode=image_mode,
|
| 328 |
+
sources=sources,
|
| 329 |
+
type=type,
|
| 330 |
+
label=label,
|
| 331 |
+
every=every,
|
| 332 |
+
inputs=inputs,
|
| 333 |
+
show_label=show_label,
|
| 334 |
+
buttons=buttons, # type: ignore
|
| 335 |
+
container=container,
|
| 336 |
+
scale=scale,
|
| 337 |
+
min_width=min_width,
|
| 338 |
+
interactive=interactive,
|
| 339 |
+
visible=visible,
|
| 340 |
+
elem_id=elem_id,
|
| 341 |
+
elem_classes=elem_classes,
|
| 342 |
+
render=render,
|
| 343 |
+
key=key,
|
| 344 |
+
preserved_by_key=preserved_by_key,
|
| 345 |
+
placeholder=placeholder,
|
| 346 |
+
webcam_options=webcam_options,
|
| 347 |
+
_selectable=_selectable,
|
| 348 |
+
transforms=transforms,
|
| 349 |
+
eraser=eraser,
|
| 350 |
+
brush=brush,
|
| 351 |
+
format=format,
|
| 352 |
+
layers=layers,
|
| 353 |
+
canvas_size=canvas_size,
|
| 354 |
+
fixed_canvas=fixed_canvas,
|
| 355 |
+
)
|
| 356 |
+
|
| 357 |
+
|
| 358 |
+
class PlayableVideo(components.Video):
|
| 359 |
+
"""
|
| 360 |
+
Sets: format="mp4"
|
| 361 |
+
"""
|
| 362 |
+
|
| 363 |
+
is_template = True
|
| 364 |
+
|
| 365 |
+
def __init__(
|
| 366 |
+
self,
|
| 367 |
+
value: (
|
| 368 |
+
str | Path | tuple[str | Path, str | Path | None] | Callable | None
|
| 369 |
+
) = None,
|
| 370 |
+
*,
|
| 371 |
+
format: Literal["mp4"] = "mp4",
|
| 372 |
+
sources: (
|
| 373 |
+
list[Literal["upload", "webcam"]] | Literal["upload", "webcam"] | None
|
| 374 |
+
) = None,
|
| 375 |
+
height: int | str | None = None,
|
| 376 |
+
width: int | str | None = None,
|
| 377 |
+
label: str | I18nData | None = None,
|
| 378 |
+
every: Timer | float | None = None,
|
| 379 |
+
inputs: (
|
| 380 |
+
components.Component
|
| 381 |
+
| Sequence[components.Component]
|
| 382 |
+
| set[components.Component]
|
| 383 |
+
| None
|
| 384 |
+
) = None,
|
| 385 |
+
show_label: bool | None = None,
|
| 386 |
+
container: bool = True,
|
| 387 |
+
scale: int | None = None,
|
| 388 |
+
min_width: int = 160,
|
| 389 |
+
interactive: bool | None = None,
|
| 390 |
+
visible: bool | Literal["hidden"] = True,
|
| 391 |
+
elem_id: str | None = None,
|
| 392 |
+
elem_classes: list[str] | str | None = None,
|
| 393 |
+
render: bool = True,
|
| 394 |
+
key: int | str | tuple[int | str, ...] | None = None,
|
| 395 |
+
preserved_by_key: list[str] | str | None = "value",
|
| 396 |
+
webcam_options: WebcamOptions | None = None,
|
| 397 |
+
include_audio: bool | None = None,
|
| 398 |
+
autoplay: bool = False,
|
| 399 |
+
buttons: list[Literal["download", "share"]] | None = None,
|
| 400 |
+
loop: bool = False,
|
| 401 |
+
streaming: bool = False,
|
| 402 |
+
watermark: str | Path | None = None,
|
| 403 |
+
subtitles: str | Path | None = None,
|
| 404 |
+
playback_position: int = 0,
|
| 405 |
+
):
|
| 406 |
+
sources = ["upload"]
|
| 407 |
+
super().__init__(
|
| 408 |
+
value=value, # type: ignore
|
| 409 |
+
format=format,
|
| 410 |
+
sources=sources, # type: ignore
|
| 411 |
+
height=height,
|
| 412 |
+
width=width,
|
| 413 |
+
label=label,
|
| 414 |
+
every=every,
|
| 415 |
+
inputs=inputs,
|
| 416 |
+
show_label=show_label,
|
| 417 |
+
container=container,
|
| 418 |
+
scale=scale,
|
| 419 |
+
min_width=min_width,
|
| 420 |
+
interactive=interactive,
|
| 421 |
+
visible=visible,
|
| 422 |
+
elem_id=elem_id,
|
| 423 |
+
elem_classes=elem_classes,
|
| 424 |
+
render=render,
|
| 425 |
+
key=key,
|
| 426 |
+
preserved_by_key=preserved_by_key,
|
| 427 |
+
include_audio=include_audio,
|
| 428 |
+
autoplay=autoplay,
|
| 429 |
+
buttons=buttons, # type: ignore
|
| 430 |
+
loop=loop,
|
| 431 |
+
streaming=streaming,
|
| 432 |
+
watermark=watermark, # type: ignore
|
| 433 |
+
webcam_options=webcam_options,
|
| 434 |
+
subtitles=subtitles,
|
| 435 |
+
playback_position=playback_position,
|
| 436 |
+
)
|
| 437 |
+
|
| 438 |
+
|
| 439 |
+
class Microphone(components.Audio):
|
| 440 |
+
"""
|
| 441 |
+
Sets: sources=["microphone"]
|
| 442 |
+
"""
|
| 443 |
+
|
| 444 |
+
is_template = True
|
| 445 |
+
|
| 446 |
+
def __init__(
|
| 447 |
+
self,
|
| 448 |
+
value: str | Path | tuple[int, np.ndarray] | Callable | None = None,
|
| 449 |
+
*,
|
| 450 |
+
sources: (
|
| 451 |
+
list[Literal["upload", "microphone"]]
|
| 452 |
+
| Literal["upload", "microphone"]
|
| 453 |
+
| None
|
| 454 |
+
) = None,
|
| 455 |
+
type: Literal["numpy", "filepath"] = "numpy",
|
| 456 |
+
label: str | I18nData | None = None,
|
| 457 |
+
every: Timer | float | None = None,
|
| 458 |
+
inputs: (
|
| 459 |
+
components.Component
|
| 460 |
+
| Sequence[components.Component]
|
| 461 |
+
| set[components.Component]
|
| 462 |
+
| None
|
| 463 |
+
) = None,
|
| 464 |
+
show_label: bool | None = None,
|
| 465 |
+
container: bool = True,
|
| 466 |
+
scale: int | None = None,
|
| 467 |
+
min_width: int = 160,
|
| 468 |
+
interactive: bool | None = None,
|
| 469 |
+
visible: bool | Literal["hidden"] = True,
|
| 470 |
+
streaming: bool = False,
|
| 471 |
+
elem_id: str | None = None,
|
| 472 |
+
elem_classes: list[str] | str | None = None,
|
| 473 |
+
render: bool = True,
|
| 474 |
+
key: int | str | tuple[int | str, ...] | None = None,
|
| 475 |
+
preserved_by_key: list[str] | str | None = "value",
|
| 476 |
+
format: Literal["wav", "mp3"] = "wav",
|
| 477 |
+
autoplay: bool = False,
|
| 478 |
+
buttons: list[Literal["download", "share"]] | None = None,
|
| 479 |
+
editable: bool = True,
|
| 480 |
+
waveform_options: WaveformOptions | dict | None = None,
|
| 481 |
+
loop: bool = False,
|
| 482 |
+
recording: bool = False,
|
| 483 |
+
subtitles: str | Path | None = None,
|
| 484 |
+
playback_position: int = 0,
|
| 485 |
+
):
|
| 486 |
+
sources = ["microphone"]
|
| 487 |
+
super().__init__(
|
| 488 |
+
value,
|
| 489 |
+
sources=sources,
|
| 490 |
+
type=type,
|
| 491 |
+
label=label,
|
| 492 |
+
every=every,
|
| 493 |
+
inputs=inputs,
|
| 494 |
+
show_label=show_label,
|
| 495 |
+
container=container,
|
| 496 |
+
scale=scale,
|
| 497 |
+
min_width=min_width,
|
| 498 |
+
interactive=interactive,
|
| 499 |
+
visible=visible,
|
| 500 |
+
streaming=streaming,
|
| 501 |
+
elem_id=elem_id,
|
| 502 |
+
elem_classes=elem_classes,
|
| 503 |
+
render=render,
|
| 504 |
+
key=key,
|
| 505 |
+
preserved_by_key=preserved_by_key,
|
| 506 |
+
format=format,
|
| 507 |
+
autoplay=autoplay,
|
| 508 |
+
buttons=buttons, # type: ignore
|
| 509 |
+
editable=editable,
|
| 510 |
+
waveform_options=waveform_options,
|
| 511 |
+
loop=loop,
|
| 512 |
+
recording=recording,
|
| 513 |
+
subtitles=subtitles,
|
| 514 |
+
playback_position=playback_position,
|
| 515 |
+
)
|
| 516 |
+
|
| 517 |
+
|
| 518 |
+
class Files(components.File):
|
| 519 |
+
"""
|
| 520 |
+
Sets: file_count="multiple"
|
| 521 |
+
"""
|
| 522 |
+
|
| 523 |
+
is_template = True
|
| 524 |
+
|
| 525 |
+
def __init__(
|
| 526 |
+
self,
|
| 527 |
+
value: str | list[str] | Callable | None = None,
|
| 528 |
+
*,
|
| 529 |
+
file_count: Literal["multiple"] = "multiple",
|
| 530 |
+
file_types: list[str] | None = None,
|
| 531 |
+
type: Literal["filepath", "binary"] = "filepath",
|
| 532 |
+
label: str | I18nData | None = None,
|
| 533 |
+
every: Timer | float | None = None,
|
| 534 |
+
inputs: (
|
| 535 |
+
components.Component
|
| 536 |
+
| Sequence[components.Component]
|
| 537 |
+
| set[components.Component]
|
| 538 |
+
| None
|
| 539 |
+
) = None,
|
| 540 |
+
show_label: bool | None = None,
|
| 541 |
+
container: bool = True,
|
| 542 |
+
scale: int | None = None,
|
| 543 |
+
min_width: int = 160,
|
| 544 |
+
height: int | float | None = None,
|
| 545 |
+
interactive: bool | None = None,
|
| 546 |
+
visible: bool | Literal["hidden"] = True,
|
| 547 |
+
elem_id: str | None = None,
|
| 548 |
+
elem_classes: list[str] | str | None = None,
|
| 549 |
+
render: bool = True,
|
| 550 |
+
key: int | str | tuple[int | str, ...] | None = None,
|
| 551 |
+
preserved_by_key: list[str] | str | None = "value",
|
| 552 |
+
allow_reordering: bool = False,
|
| 553 |
+
buttons: list[components.Button] | None = None,
|
| 554 |
+
):
|
| 555 |
+
super().__init__(
|
| 556 |
+
value,
|
| 557 |
+
file_count=file_count,
|
| 558 |
+
file_types=file_types,
|
| 559 |
+
type=type,
|
| 560 |
+
label=label,
|
| 561 |
+
every=every,
|
| 562 |
+
inputs=inputs,
|
| 563 |
+
show_label=show_label,
|
| 564 |
+
container=container,
|
| 565 |
+
scale=scale,
|
| 566 |
+
min_width=min_width,
|
| 567 |
+
height=height,
|
| 568 |
+
interactive=interactive,
|
| 569 |
+
visible=visible,
|
| 570 |
+
elem_id=elem_id,
|
| 571 |
+
elem_classes=elem_classes,
|
| 572 |
+
render=render,
|
| 573 |
+
key=key,
|
| 574 |
+
preserved_by_key=preserved_by_key,
|
| 575 |
+
buttons=buttons, # type: ignore
|
| 576 |
+
allow_reordering=allow_reordering,
|
| 577 |
+
)
|
| 578 |
+
|
| 579 |
+
|
| 580 |
+
class Numpy(components.Dataframe):
|
| 581 |
+
"""
|
| 582 |
+
Sets: type="numpy"
|
| 583 |
+
"""
|
| 584 |
+
|
| 585 |
+
is_template = True
|
| 586 |
+
|
| 587 |
+
def __init__(
|
| 588 |
+
self,
|
| 589 |
+
value: list[list[Any]] | Callable | None = None,
|
| 590 |
+
*,
|
| 591 |
+
headers: list[str] | None = None,
|
| 592 |
+
row_count: int | tuple[int, str] = (1, "dynamic"),
|
| 593 |
+
row_limits: tuple[int | None, int | None] | None = None,
|
| 594 |
+
col_count: int | tuple[int, str] | None = None,
|
| 595 |
+
column_count: int | tuple[int, str] | None = None,
|
| 596 |
+
column_limits: tuple[int | None, int | None] | None = None,
|
| 597 |
+
datatype: (
|
| 598 |
+
Literal["str", "number", "bool", "date", "markdown", "html"]
|
| 599 |
+
| Sequence[Literal["str", "number", "bool", "date", "markdown", "html"]]
|
| 600 |
+
) = "str",
|
| 601 |
+
type: Literal["numpy"] = "numpy",
|
| 602 |
+
latex_delimiters: list[dict[str, str | bool]] | None = None,
|
| 603 |
+
label: str | I18nData | None = None,
|
| 604 |
+
show_label: bool | None = None,
|
| 605 |
+
every: Timer | float | None = None,
|
| 606 |
+
inputs: (
|
| 607 |
+
components.Component
|
| 608 |
+
| Sequence[components.Component]
|
| 609 |
+
| set[components.Component]
|
| 610 |
+
| None
|
| 611 |
+
) = None,
|
| 612 |
+
max_height: int = 500,
|
| 613 |
+
scale: int | None = None,
|
| 614 |
+
min_width: int = 160,
|
| 615 |
+
interactive: bool | None = None,
|
| 616 |
+
visible: bool | Literal["hidden"] = True,
|
| 617 |
+
elem_id: str | None = None,
|
| 618 |
+
elem_classes: list[str] | str | None = None,
|
| 619 |
+
render: bool = True,
|
| 620 |
+
key: int | str | tuple[int | str, ...] | None = None,
|
| 621 |
+
preserved_by_key: list[str] | str | None = "value",
|
| 622 |
+
wrap: bool = False,
|
| 623 |
+
line_breaks: bool = True,
|
| 624 |
+
column_widths: list[str | int] | None = None,
|
| 625 |
+
show_row_numbers: bool = False,
|
| 626 |
+
show_search: Literal["none", "search", "filter"] = "none",
|
| 627 |
+
static_columns: list[int] | None = None,
|
| 628 |
+
pinned_columns: int | None = None,
|
| 629 |
+
max_chars: int | None = None,
|
| 630 |
+
buttons: list[Literal["fullscreen", "copy"]] | None = None,
|
| 631 |
+
):
|
| 632 |
+
super().__init__(
|
| 633 |
+
value=value,
|
| 634 |
+
headers=headers,
|
| 635 |
+
row_count=row_count, # type: ignore
|
| 636 |
+
row_limits=row_limits,
|
| 637 |
+
col_count=col_count, # type: ignore
|
| 638 |
+
column_count=column_count, # type: ignore
|
| 639 |
+
column_limits=column_limits,
|
| 640 |
+
datatype=datatype,
|
| 641 |
+
type=type,
|
| 642 |
+
label=label,
|
| 643 |
+
show_label=show_label,
|
| 644 |
+
interactive=interactive,
|
| 645 |
+
visible=visible,
|
| 646 |
+
elem_id=elem_id,
|
| 647 |
+
wrap=wrap,
|
| 648 |
+
elem_classes=elem_classes,
|
| 649 |
+
render=render,
|
| 650 |
+
key=key,
|
| 651 |
+
preserved_by_key=preserved_by_key,
|
| 652 |
+
line_breaks=line_breaks,
|
| 653 |
+
column_widths=column_widths,
|
| 654 |
+
every=every,
|
| 655 |
+
inputs=inputs,
|
| 656 |
+
max_height=max_height,
|
| 657 |
+
scale=scale,
|
| 658 |
+
latex_delimiters=latex_delimiters,
|
| 659 |
+
min_width=min_width,
|
| 660 |
+
show_row_numbers=show_row_numbers,
|
| 661 |
+
show_search=show_search,
|
| 662 |
+
pinned_columns=pinned_columns,
|
| 663 |
+
buttons=buttons, # type: ignore
|
| 664 |
+
static_columns=static_columns,
|
| 665 |
+
max_chars=max_chars,
|
| 666 |
+
)
|
| 667 |
+
|
| 668 |
+
|
| 669 |
+
class Matrix(components.Dataframe):
|
| 670 |
+
"""
|
| 671 |
+
Sets: type="array"
|
| 672 |
+
"""
|
| 673 |
+
|
| 674 |
+
is_template = True
|
| 675 |
+
|
| 676 |
+
def __init__(
|
| 677 |
+
self,
|
| 678 |
+
value: list[list[Any]] | Callable | None = None,
|
| 679 |
+
*,
|
| 680 |
+
headers: list[str] | None = None,
|
| 681 |
+
row_count: int | tuple[int, str] = (1, "dynamic"),
|
| 682 |
+
row_limits: tuple[int | None, int | None] | None = None,
|
| 683 |
+
col_count: int | tuple[int, str] | None = None,
|
| 684 |
+
column_count: int | tuple[int, str] | None = None,
|
| 685 |
+
column_limits: tuple[int | None, int | None] | None = None,
|
| 686 |
+
datatype: (
|
| 687 |
+
Literal["str", "number", "bool", "date", "markdown", "html"]
|
| 688 |
+
| Sequence[Literal["str", "number", "bool", "date", "markdown", "html"]]
|
| 689 |
+
) = "str",
|
| 690 |
+
type: Literal["array"] = "array",
|
| 691 |
+
latex_delimiters: list[dict[str, str | bool]] | None = None,
|
| 692 |
+
label: str | I18nData | None = None,
|
| 693 |
+
show_label: bool | None = None,
|
| 694 |
+
every: Timer | float | None = None,
|
| 695 |
+
inputs: (
|
| 696 |
+
components.Component
|
| 697 |
+
| Sequence[components.Component]
|
| 698 |
+
| set[components.Component]
|
| 699 |
+
| None
|
| 700 |
+
) = None,
|
| 701 |
+
max_height: int = 500,
|
| 702 |
+
scale: int | None = None,
|
| 703 |
+
min_width: int = 160,
|
| 704 |
+
interactive: bool | None = None,
|
| 705 |
+
visible: bool | Literal["hidden"] = True,
|
| 706 |
+
elem_id: str | None = None,
|
| 707 |
+
elem_classes: list[str] | str | None = None,
|
| 708 |
+
render: bool = True,
|
| 709 |
+
key: int | str | tuple[int | str, ...] | None = None,
|
| 710 |
+
preserved_by_key: list[str] | str | None = "value",
|
| 711 |
+
wrap: bool = False,
|
| 712 |
+
line_breaks: bool = True,
|
| 713 |
+
column_widths: list[str | int] | None = None,
|
| 714 |
+
show_row_numbers: bool = False,
|
| 715 |
+
show_search: Literal["none", "search", "filter"] = "none",
|
| 716 |
+
pinned_columns: int | None = None,
|
| 717 |
+
max_chars: int | None = None,
|
| 718 |
+
buttons: list[Literal["fullscreen", "copy"]] | None = None,
|
| 719 |
+
static_columns: list[int] | None = None,
|
| 720 |
+
):
|
| 721 |
+
super().__init__(
|
| 722 |
+
value=value,
|
| 723 |
+
headers=headers,
|
| 724 |
+
row_count=row_count, # type: ignore
|
| 725 |
+
row_limits=row_limits,
|
| 726 |
+
col_count=col_count, # type: ignore
|
| 727 |
+
column_count=column_count, # type: ignore
|
| 728 |
+
column_limits=column_limits,
|
| 729 |
+
datatype=datatype,
|
| 730 |
+
type=type,
|
| 731 |
+
label=label,
|
| 732 |
+
show_label=show_label,
|
| 733 |
+
interactive=interactive,
|
| 734 |
+
visible=visible,
|
| 735 |
+
elem_id=elem_id,
|
| 736 |
+
wrap=wrap,
|
| 737 |
+
elem_classes=elem_classes,
|
| 738 |
+
render=render,
|
| 739 |
+
key=key,
|
| 740 |
+
preserved_by_key=preserved_by_key,
|
| 741 |
+
line_breaks=line_breaks,
|
| 742 |
+
column_widths=column_widths,
|
| 743 |
+
every=every,
|
| 744 |
+
inputs=inputs,
|
| 745 |
+
max_height=max_height,
|
| 746 |
+
scale=scale,
|
| 747 |
+
latex_delimiters=latex_delimiters,
|
| 748 |
+
min_width=min_width,
|
| 749 |
+
show_row_numbers=show_row_numbers,
|
| 750 |
+
show_search=show_search,
|
| 751 |
+
pinned_columns=pinned_columns,
|
| 752 |
+
buttons=buttons, # type: ignore
|
| 753 |
+
static_columns=static_columns,
|
| 754 |
+
max_chars=max_chars,
|
| 755 |
+
)
|
| 756 |
+
|
| 757 |
+
|
| 758 |
+
class List(components.Dataframe):
|
| 759 |
+
"""
|
| 760 |
+
Sets: type="array", col_count=1
|
| 761 |
+
"""
|
| 762 |
+
|
| 763 |
+
is_template = True
|
| 764 |
+
|
| 765 |
+
def __init__(
|
| 766 |
+
self,
|
| 767 |
+
value: list[list[Any]] | Callable | None = None,
|
| 768 |
+
*,
|
| 769 |
+
headers: list[str] | None = None,
|
| 770 |
+
row_count: int | tuple[int, str] = (1, "dynamic"),
|
| 771 |
+
row_limits: tuple[int | None, int | None] | None = None,
|
| 772 |
+
col_count: Literal[1] = 1,
|
| 773 |
+
column_count: Literal[1] | None = None,
|
| 774 |
+
column_limits: tuple[int | None, int | None] | None = None,
|
| 775 |
+
datatype: (
|
| 776 |
+
Literal["str", "number", "bool", "date", "markdown", "html"]
|
| 777 |
+
| Sequence[Literal["str", "number", "bool", "date", "markdown", "html"]]
|
| 778 |
+
) = "str",
|
| 779 |
+
type: Literal["array"] = "array",
|
| 780 |
+
latex_delimiters: list[dict[str, str | bool]] | None = None,
|
| 781 |
+
label: str | I18nData | None = None,
|
| 782 |
+
show_label: bool | None = None,
|
| 783 |
+
every: Timer | float | None = None,
|
| 784 |
+
inputs: (
|
| 785 |
+
components.Component
|
| 786 |
+
| Sequence[components.Component]
|
| 787 |
+
| set[components.Component]
|
| 788 |
+
| None
|
| 789 |
+
) = None,
|
| 790 |
+
max_height: int = 500,
|
| 791 |
+
scale: int | None = None,
|
| 792 |
+
min_width: int = 160,
|
| 793 |
+
interactive: bool | None = None,
|
| 794 |
+
visible: bool | Literal["hidden"] = True,
|
| 795 |
+
elem_id: str | None = None,
|
| 796 |
+
elem_classes: list[str] | str | None = None,
|
| 797 |
+
render: bool = True,
|
| 798 |
+
key: int | str | tuple[int | str, ...] | None = None,
|
| 799 |
+
preserved_by_key: list[str] | str | None = "value",
|
| 800 |
+
wrap: bool = False,
|
| 801 |
+
line_breaks: bool = True,
|
| 802 |
+
column_widths: list[str | int] | None = None,
|
| 803 |
+
show_row_numbers: bool = False,
|
| 804 |
+
show_search: Literal["none", "search", "filter"] = "none",
|
| 805 |
+
pinned_columns: int | None = None,
|
| 806 |
+
max_chars: int | None = None,
|
| 807 |
+
buttons: list[Literal["fullscreen", "copy"]] | None = None,
|
| 808 |
+
static_columns: list[int] | None = None,
|
| 809 |
+
):
|
| 810 |
+
super().__init__(
|
| 811 |
+
value=value,
|
| 812 |
+
headers=headers,
|
| 813 |
+
row_count=row_count, # type: ignore
|
| 814 |
+
row_limits=row_limits,
|
| 815 |
+
col_count=col_count, # type: ignore
|
| 816 |
+
column_count=column_count, # type: ignore
|
| 817 |
+
column_limits=column_limits,
|
| 818 |
+
datatype=datatype,
|
| 819 |
+
type=type,
|
| 820 |
+
label=label,
|
| 821 |
+
show_label=show_label,
|
| 822 |
+
interactive=interactive,
|
| 823 |
+
visible=visible,
|
| 824 |
+
elem_id=elem_id,
|
| 825 |
+
wrap=wrap,
|
| 826 |
+
elem_classes=elem_classes,
|
| 827 |
+
render=render,
|
| 828 |
+
key=key,
|
| 829 |
+
preserved_by_key=preserved_by_key,
|
| 830 |
+
line_breaks=line_breaks,
|
| 831 |
+
column_widths=column_widths,
|
| 832 |
+
every=every,
|
| 833 |
+
inputs=inputs,
|
| 834 |
+
max_height=max_height,
|
| 835 |
+
scale=scale,
|
| 836 |
+
latex_delimiters=latex_delimiters,
|
| 837 |
+
min_width=min_width,
|
| 838 |
+
show_row_numbers=show_row_numbers,
|
| 839 |
+
show_search=show_search,
|
| 840 |
+
static_columns=static_columns,
|
| 841 |
+
pinned_columns=pinned_columns,
|
| 842 |
+
buttons=buttons, # type: ignore
|
| 843 |
+
max_chars=max_chars,
|
| 844 |
+
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from __future__ import annotations
|
| 2 |
+
|
| 3 |
+
from collections.abc import Callable, Iterable, Sequence
|
| 4 |
+
from pathlib import Path
|
| 5 |
+
from typing import TYPE_CHECKING, Any, Literal
|
| 6 |
+
|
| 7 |
+
import numpy as np
|
| 8 |
+
import PIL.Image
|
| 9 |
+
|
| 10 |
+
from gradio import components
|
| 11 |
+
from gradio.components.audio import WaveformOptions
|
| 12 |
+
from gradio.components.image_editor import Brush, Eraser, LayerOptions, WebcamOptions
|
| 13 |
+
from gradio.components.textbox import InputHTMLAttributes
|
| 14 |
+
from gradio.i18n import I18nData
|
| 15 |
+
|
| 16 |
+
if TYPE_CHECKING:
|
| 17 |
+
from gradio.components import Timer
|
| 18 |
+
|
| 19 |
+
from gradio.events import Dependency
|
| 20 |
+
|
| 21 |
+
class TextArea(components.Textbox):
|
| 22 |
+
"""
|
| 23 |
+
Sets: lines=7
|
| 24 |
+
"""
|
| 25 |
+
|
| 26 |
+
is_template = True
|
| 27 |
+
|
| 28 |
+
def __init__(
|
| 29 |
+
self,
|
| 30 |
+
value: str | Callable | None = None,
|
| 31 |
+
*,
|
| 32 |
+
lines: int = 7,
|
| 33 |
+
max_lines: int = 20,
|
| 34 |
+
placeholder: str | None = None,
|
| 35 |
+
label: str | I18nData | None = None,
|
| 36 |
+
info: str | I18nData | None = None,
|
| 37 |
+
every: Timer | float | None = None,
|
| 38 |
+
inputs: (
|
| 39 |
+
components.Component
|
| 40 |
+
| Sequence[components.Component]
|
| 41 |
+
| set[components.Component]
|
| 42 |
+
| None
|
| 43 |
+
) = None,
|
| 44 |
+
show_label: bool | None = None,
|
| 45 |
+
container: bool = True,
|
| 46 |
+
scale: int | None = None,
|
| 47 |
+
min_width: int = 160,
|
| 48 |
+
interactive: bool | None = None,
|
| 49 |
+
visible: bool | Literal["hidden"] | Literal["hidden"] = True,
|
| 50 |
+
elem_id: str | None = None,
|
| 51 |
+
autofocus: bool = False,
|
| 52 |
+
autoscroll: bool = True,
|
| 53 |
+
elem_classes: list[str] | str | None = None,
|
| 54 |
+
render: bool = True,
|
| 55 |
+
key: int | str | tuple[int | str, ...] | None = None,
|
| 56 |
+
preserved_by_key: list[str] | str | None = "value",
|
| 57 |
+
type: Literal["text", "password", "email"] = "text",
|
| 58 |
+
text_align: Literal["left", "right"] | None = None,
|
| 59 |
+
rtl: bool = False,
|
| 60 |
+
buttons: list[Literal["fullscreen", "copy"]] | None = None,
|
| 61 |
+
max_length: int | None = None,
|
| 62 |
+
submit_btn: str | bool | None = False,
|
| 63 |
+
stop_btn: str | bool | None = False,
|
| 64 |
+
html_attributes: InputHTMLAttributes | None = None,
|
| 65 |
+
):
|
| 66 |
+
super().__init__(
|
| 67 |
+
value=value,
|
| 68 |
+
lines=lines,
|
| 69 |
+
max_lines=max_lines,
|
| 70 |
+
placeholder=placeholder,
|
| 71 |
+
label=label,
|
| 72 |
+
info=info,
|
| 73 |
+
every=every,
|
| 74 |
+
inputs=inputs,
|
| 75 |
+
show_label=show_label,
|
| 76 |
+
container=container,
|
| 77 |
+
scale=scale,
|
| 78 |
+
min_width=min_width,
|
| 79 |
+
interactive=interactive,
|
| 80 |
+
visible=visible,
|
| 81 |
+
elem_id=elem_id,
|
| 82 |
+
autofocus=autofocus,
|
| 83 |
+
autoscroll=autoscroll,
|
| 84 |
+
elem_classes=elem_classes,
|
| 85 |
+
render=render,
|
| 86 |
+
key=key,
|
| 87 |
+
preserved_by_key=preserved_by_key,
|
| 88 |
+
type=type,
|
| 89 |
+
text_align=text_align,
|
| 90 |
+
rtl=rtl,
|
| 91 |
+
buttons=buttons, # type: ignore
|
| 92 |
+
max_length=max_length,
|
| 93 |
+
submit_btn=submit_btn,
|
| 94 |
+
stop_btn=stop_btn,
|
| 95 |
+
html_attributes=html_attributes,
|
| 96 |
+
)
|
| 97 |
+
from typing import Callable, Literal, Sequence, Any, TYPE_CHECKING
|
| 98 |
+
from gradio.blocks import Block
|
| 99 |
+
if TYPE_CHECKING:
|
| 100 |
+
from gradio.components import Timer
|
| 101 |
+
from gradio.components.base import Component
|
| 102 |
+
|
| 103 |
+
|
| 104 |
+
class Sketchpad(components.ImageEditor):
|
| 105 |
+
"""
|
| 106 |
+
Sets: sources=(), brush=Brush(colors=["#000000"], color_mode="fixed")
|
| 107 |
+
"""
|
| 108 |
+
|
| 109 |
+
is_template = True
|
| 110 |
+
|
| 111 |
+
def __init__(
|
| 112 |
+
self,
|
| 113 |
+
value: str | PIL.Image.Image | np.ndarray | None = None,
|
| 114 |
+
*,
|
| 115 |
+
height: int | str | None = None,
|
| 116 |
+
width: int | str | None = None,
|
| 117 |
+
image_mode: Literal[
|
| 118 |
+
"1", "L", "P", "RGB", "RGBA", "CMYK", "YCbCr", "LAB", "HSV", "I", "F"
|
| 119 |
+
] = "RGBA",
|
| 120 |
+
sources: Iterable[Literal["upload", "webcam", "clipboard"]] = (),
|
| 121 |
+
type: Literal["numpy", "pil", "filepath"] = "numpy",
|
| 122 |
+
label: str | I18nData | None = None,
|
| 123 |
+
every: Timer | float | None = None,
|
| 124 |
+
inputs: (
|
| 125 |
+
components.Component
|
| 126 |
+
| Sequence[components.Component]
|
| 127 |
+
| set[components.Component]
|
| 128 |
+
| None
|
| 129 |
+
) = None,
|
| 130 |
+
show_label: bool | None = None,
|
| 131 |
+
buttons: list[Literal["download", "share", "fullscreen"]] | None = None,
|
| 132 |
+
container: bool = True,
|
| 133 |
+
scale: int | None = None,
|
| 134 |
+
min_width: int = 160,
|
| 135 |
+
interactive: bool | None = None,
|
| 136 |
+
visible: bool | Literal["hidden"] = True,
|
| 137 |
+
elem_id: str | None = None,
|
| 138 |
+
elem_classes: list[str] | str | None = None,
|
| 139 |
+
render: bool = True,
|
| 140 |
+
key: int | str | tuple[int | str, ...] | None = None,
|
| 141 |
+
preserved_by_key: list[str] | str | None = "value",
|
| 142 |
+
placeholder: str | None = None,
|
| 143 |
+
webcam_options: WebcamOptions | None = None,
|
| 144 |
+
_selectable: bool = False,
|
| 145 |
+
transforms: Iterable[Literal["crop"]] = ("crop",),
|
| 146 |
+
eraser: Eraser | None = None,
|
| 147 |
+
brush: Brush | None = None,
|
| 148 |
+
format: str = "webp",
|
| 149 |
+
canvas_size: tuple[int, int] = (800, 800),
|
| 150 |
+
fixed_canvas: bool = False,
|
| 151 |
+
layers: LayerOptions | bool = True,
|
| 152 |
+
):
|
| 153 |
+
if not brush:
|
| 154 |
+
brush = Brush(colors=["#000000"], color_mode="fixed")
|
| 155 |
+
super().__init__(
|
| 156 |
+
value=value,
|
| 157 |
+
height=height,
|
| 158 |
+
width=width,
|
| 159 |
+
image_mode=image_mode,
|
| 160 |
+
sources=sources,
|
| 161 |
+
type=type,
|
| 162 |
+
label=label,
|
| 163 |
+
every=every,
|
| 164 |
+
inputs=inputs,
|
| 165 |
+
show_label=show_label,
|
| 166 |
+
buttons=buttons, # type: ignore
|
| 167 |
+
container=container,
|
| 168 |
+
scale=scale,
|
| 169 |
+
min_width=min_width,
|
| 170 |
+
interactive=interactive,
|
| 171 |
+
visible=visible,
|
| 172 |
+
elem_id=elem_id,
|
| 173 |
+
elem_classes=elem_classes,
|
| 174 |
+
render=render,
|
| 175 |
+
key=key,
|
| 176 |
+
preserved_by_key=preserved_by_key,
|
| 177 |
+
placeholder=placeholder,
|
| 178 |
+
webcam_options=webcam_options,
|
| 179 |
+
_selectable=_selectable,
|
| 180 |
+
transforms=transforms,
|
| 181 |
+
eraser=eraser,
|
| 182 |
+
brush=brush,
|
| 183 |
+
format=format,
|
| 184 |
+
layers=layers,
|
| 185 |
+
canvas_size=canvas_size,
|
| 186 |
+
fixed_canvas=fixed_canvas,
|
| 187 |
+
)
|
| 188 |
+
from typing import Callable, Literal, Sequence, Any, TYPE_CHECKING
|
| 189 |
+
from gradio.blocks import Block
|
| 190 |
+
if TYPE_CHECKING:
|
| 191 |
+
from gradio.components import Timer
|
| 192 |
+
from gradio.components.base import Component
|
| 193 |
+
|
| 194 |
+
|
| 195 |
+
class Paint(components.ImageEditor):
|
| 196 |
+
"""
|
| 197 |
+
Sets: sources=()
|
| 198 |
+
"""
|
| 199 |
+
|
| 200 |
+
is_template = True
|
| 201 |
+
|
| 202 |
+
def __init__(
|
| 203 |
+
self,
|
| 204 |
+
value: str | PIL.Image.Image | np.ndarray | None = None,
|
| 205 |
+
*,
|
| 206 |
+
height: int | str | None = None,
|
| 207 |
+
width: int | str | None = None,
|
| 208 |
+
image_mode: Literal[
|
| 209 |
+
"1", "L", "P", "RGB", "RGBA", "CMYK", "YCbCr", "LAB", "HSV", "I", "F"
|
| 210 |
+
] = "RGBA",
|
| 211 |
+
sources: Iterable[Literal["upload", "webcam", "clipboard"]] = (),
|
| 212 |
+
type: Literal["numpy", "pil", "filepath"] = "numpy",
|
| 213 |
+
label: str | I18nData | None = None,
|
| 214 |
+
every: Timer | float | None = None,
|
| 215 |
+
inputs: (
|
| 216 |
+
components.Component
|
| 217 |
+
| Sequence[components.Component]
|
| 218 |
+
| set[components.Component]
|
| 219 |
+
| None
|
| 220 |
+
) = None,
|
| 221 |
+
show_label: bool | None = None,
|
| 222 |
+
buttons: list[Literal["download", "share", "fullscreen"]] | None = None,
|
| 223 |
+
container: bool = True,
|
| 224 |
+
scale: int | None = None,
|
| 225 |
+
min_width: int = 160,
|
| 226 |
+
interactive: bool | None = None,
|
| 227 |
+
visible: bool | Literal["hidden"] = True,
|
| 228 |
+
elem_id: str | None = None,
|
| 229 |
+
elem_classes: list[str] | str | None = None,
|
| 230 |
+
render: bool = True,
|
| 231 |
+
key: int | str | tuple[int | str, ...] | None = None,
|
| 232 |
+
preserved_by_key: list[str] | str | None = "value",
|
| 233 |
+
webcam_options: WebcamOptions | None = None,
|
| 234 |
+
_selectable: bool = False,
|
| 235 |
+
transforms: Iterable[Literal["crop"]] = ("crop",),
|
| 236 |
+
eraser: Eraser | None = None,
|
| 237 |
+
brush: Brush | None = None,
|
| 238 |
+
format: str = "webp",
|
| 239 |
+
layers: LayerOptions | bool = True,
|
| 240 |
+
canvas_size: tuple[int, int] = (800, 800),
|
| 241 |
+
fixed_canvas: bool = False,
|
| 242 |
+
placeholder: str | None = None,
|
| 243 |
+
):
|
| 244 |
+
super().__init__(
|
| 245 |
+
value=value,
|
| 246 |
+
height=height,
|
| 247 |
+
width=width,
|
| 248 |
+
image_mode=image_mode,
|
| 249 |
+
sources=sources,
|
| 250 |
+
type=type,
|
| 251 |
+
label=label,
|
| 252 |
+
every=every,
|
| 253 |
+
inputs=inputs,
|
| 254 |
+
show_label=show_label,
|
| 255 |
+
buttons=buttons, # type: ignore
|
| 256 |
+
container=container,
|
| 257 |
+
scale=scale,
|
| 258 |
+
min_width=min_width,
|
| 259 |
+
interactive=interactive,
|
| 260 |
+
visible=visible,
|
| 261 |
+
elem_id=elem_id,
|
| 262 |
+
elem_classes=elem_classes,
|
| 263 |
+
render=render,
|
| 264 |
+
key=key,
|
| 265 |
+
preserved_by_key=preserved_by_key,
|
| 266 |
+
webcam_options=webcam_options,
|
| 267 |
+
_selectable=_selectable,
|
| 268 |
+
transforms=transforms,
|
| 269 |
+
eraser=eraser,
|
| 270 |
+
brush=brush,
|
| 271 |
+
format=format,
|
| 272 |
+
layers=layers,
|
| 273 |
+
canvas_size=canvas_size,
|
| 274 |
+
placeholder=placeholder,
|
| 275 |
+
fixed_canvas=fixed_canvas,
|
| 276 |
+
)
|
| 277 |
+
from typing import Callable, Literal, Sequence, Any, TYPE_CHECKING
|
| 278 |
+
from gradio.blocks import Block
|
| 279 |
+
if TYPE_CHECKING:
|
| 280 |
+
from gradio.components import Timer
|
| 281 |
+
from gradio.components.base import Component
|
| 282 |
+
|
| 283 |
+
|
| 284 |
+
class ImageMask(components.ImageEditor):
|
| 285 |
+
"""
|
| 286 |
+
Sets: brush=Brush(colors=["#000000"], color_mode="fixed")
|
| 287 |
+
"""
|
| 288 |
+
|
| 289 |
+
is_template = True
|
| 290 |
+
|
| 291 |
+
def __init__(
|
| 292 |
+
self,
|
| 293 |
+
value: str | PIL.Image.Image | np.ndarray | None = None,
|
| 294 |
+
*,
|
| 295 |
+
height: int | str | None = None,
|
| 296 |
+
width: int | str | None = None,
|
| 297 |
+
image_mode: Literal[
|
| 298 |
+
"1", "L", "P", "RGB", "RGBA", "CMYK", "YCbCr", "LAB", "HSV", "I", "F"
|
| 299 |
+
] = "RGBA",
|
| 300 |
+
sources: Iterable[Literal["upload", "webcam", "clipboard"]] = (
|
| 301 |
+
"upload",
|
| 302 |
+
"webcam",
|
| 303 |
+
"clipboard",
|
| 304 |
+
),
|
| 305 |
+
type: Literal["numpy", "pil", "filepath"] = "numpy",
|
| 306 |
+
label: str | I18nData | None = None,
|
| 307 |
+
every: Timer | float | None = None,
|
| 308 |
+
inputs: (
|
| 309 |
+
components.Component
|
| 310 |
+
| Sequence[components.Component]
|
| 311 |
+
| set[components.Component]
|
| 312 |
+
| None
|
| 313 |
+
) = None,
|
| 314 |
+
show_label: bool | None = None,
|
| 315 |
+
buttons: list[Literal["download", "share", "fullscreen"]] | None = None,
|
| 316 |
+
container: bool = True,
|
| 317 |
+
scale: int | None = None,
|
| 318 |
+
min_width: int = 160,
|
| 319 |
+
interactive: bool | None = None,
|
| 320 |
+
visible: bool | Literal["hidden"] = True,
|
| 321 |
+
elem_id: str | None = None,
|
| 322 |
+
elem_classes: list[str] | str | None = None,
|
| 323 |
+
render: bool = True,
|
| 324 |
+
key: int | str | tuple[int | str, ...] | None = None,
|
| 325 |
+
preserved_by_key: list[str] | str | None = "value",
|
| 326 |
+
placeholder: str | None = None,
|
| 327 |
+
_selectable: bool = False,
|
| 328 |
+
transforms: Iterable[Literal["crop"]] = ("crop",),
|
| 329 |
+
eraser: Eraser | None = None,
|
| 330 |
+
brush: Brush | None = None,
|
| 331 |
+
format: str = "webp",
|
| 332 |
+
layers: LayerOptions | bool = False,
|
| 333 |
+
canvas_size: tuple[int, int] = (800, 800),
|
| 334 |
+
fixed_canvas: bool = False,
|
| 335 |
+
webcam_options: WebcamOptions | None = None,
|
| 336 |
+
):
|
| 337 |
+
if not brush:
|
| 338 |
+
brush = Brush(colors=["#000000"], color_mode="fixed")
|
| 339 |
+
super().__init__(
|
| 340 |
+
value=value,
|
| 341 |
+
height=height,
|
| 342 |
+
width=width,
|
| 343 |
+
image_mode=image_mode,
|
| 344 |
+
sources=sources,
|
| 345 |
+
type=type,
|
| 346 |
+
label=label,
|
| 347 |
+
every=every,
|
| 348 |
+
inputs=inputs,
|
| 349 |
+
show_label=show_label,
|
| 350 |
+
buttons=buttons, # type: ignore
|
| 351 |
+
container=container,
|
| 352 |
+
scale=scale,
|
| 353 |
+
min_width=min_width,
|
| 354 |
+
interactive=interactive,
|
| 355 |
+
visible=visible,
|
| 356 |
+
elem_id=elem_id,
|
| 357 |
+
elem_classes=elem_classes,
|
| 358 |
+
render=render,
|
| 359 |
+
key=key,
|
| 360 |
+
preserved_by_key=preserved_by_key,
|
| 361 |
+
placeholder=placeholder,
|
| 362 |
+
webcam_options=webcam_options,
|
| 363 |
+
_selectable=_selectable,
|
| 364 |
+
transforms=transforms,
|
| 365 |
+
eraser=eraser,
|
| 366 |
+
brush=brush,
|
| 367 |
+
format=format,
|
| 368 |
+
layers=layers,
|
| 369 |
+
canvas_size=canvas_size,
|
| 370 |
+
fixed_canvas=fixed_canvas,
|
| 371 |
+
)
|
| 372 |
+
from typing import Callable, Literal, Sequence, Any, TYPE_CHECKING
|
| 373 |
+
from gradio.blocks import Block
|
| 374 |
+
if TYPE_CHECKING:
|
| 375 |
+
from gradio.components import Timer
|
| 376 |
+
from gradio.components.base import Component
|
| 377 |
+
|
| 378 |
+
|
| 379 |
+
class PlayableVideo(components.Video):
|
| 380 |
+
"""
|
| 381 |
+
Sets: format="mp4"
|
| 382 |
+
"""
|
| 383 |
+
|
| 384 |
+
is_template = True
|
| 385 |
+
|
| 386 |
+
def __init__(
|
| 387 |
+
self,
|
| 388 |
+
value: (
|
| 389 |
+
str | Path | tuple[str | Path, str | Path | None] | Callable | None
|
| 390 |
+
) = None,
|
| 391 |
+
*,
|
| 392 |
+
format: Literal["mp4"] = "mp4",
|
| 393 |
+
sources: (
|
| 394 |
+
list[Literal["upload", "webcam"]] | Literal["upload", "webcam"] | None
|
| 395 |
+
) = None,
|
| 396 |
+
height: int | str | None = None,
|
| 397 |
+
width: int | str | None = None,
|
| 398 |
+
label: str | I18nData | None = None,
|
| 399 |
+
every: Timer | float | None = None,
|
| 400 |
+
inputs: (
|
| 401 |
+
components.Component
|
| 402 |
+
| Sequence[components.Component]
|
| 403 |
+
| set[components.Component]
|
| 404 |
+
| None
|
| 405 |
+
) = None,
|
| 406 |
+
show_label: bool | None = None,
|
| 407 |
+
container: bool = True,
|
| 408 |
+
scale: int | None = None,
|
| 409 |
+
min_width: int = 160,
|
| 410 |
+
interactive: bool | None = None,
|
| 411 |
+
visible: bool | Literal["hidden"] = True,
|
| 412 |
+
elem_id: str | None = None,
|
| 413 |
+
elem_classes: list[str] | str | None = None,
|
| 414 |
+
render: bool = True,
|
| 415 |
+
key: int | str | tuple[int | str, ...] | None = None,
|
| 416 |
+
preserved_by_key: list[str] | str | None = "value",
|
| 417 |
+
webcam_options: WebcamOptions | None = None,
|
| 418 |
+
include_audio: bool | None = None,
|
| 419 |
+
autoplay: bool = False,
|
| 420 |
+
buttons: list[Literal["download", "share"]] | None = None,
|
| 421 |
+
loop: bool = False,
|
| 422 |
+
streaming: bool = False,
|
| 423 |
+
watermark: str | Path | None = None,
|
| 424 |
+
subtitles: str | Path | None = None,
|
| 425 |
+
playback_position: int = 0,
|
| 426 |
+
):
|
| 427 |
+
sources = ["upload"]
|
| 428 |
+
super().__init__(
|
| 429 |
+
value=value, # type: ignore
|
| 430 |
+
format=format,
|
| 431 |
+
sources=sources, # type: ignore
|
| 432 |
+
height=height,
|
| 433 |
+
width=width,
|
| 434 |
+
label=label,
|
| 435 |
+
every=every,
|
| 436 |
+
inputs=inputs,
|
| 437 |
+
show_label=show_label,
|
| 438 |
+
container=container,
|
| 439 |
+
scale=scale,
|
| 440 |
+
min_width=min_width,
|
| 441 |
+
interactive=interactive,
|
| 442 |
+
visible=visible,
|
| 443 |
+
elem_id=elem_id,
|
| 444 |
+
elem_classes=elem_classes,
|
| 445 |
+
render=render,
|
| 446 |
+
key=key,
|
| 447 |
+
preserved_by_key=preserved_by_key,
|
| 448 |
+
include_audio=include_audio,
|
| 449 |
+
autoplay=autoplay,
|
| 450 |
+
buttons=buttons, # type: ignore
|
| 451 |
+
loop=loop,
|
| 452 |
+
streaming=streaming,
|
| 453 |
+
watermark=watermark, # type: ignore
|
| 454 |
+
webcam_options=webcam_options,
|
| 455 |
+
subtitles=subtitles,
|
| 456 |
+
playback_position=playback_position,
|
| 457 |
+
)
|
| 458 |
+
from typing import Callable, Literal, Sequence, Any, TYPE_CHECKING
|
| 459 |
+
from gradio.blocks import Block
|
| 460 |
+
if TYPE_CHECKING:
|
| 461 |
+
from gradio.components import Timer
|
| 462 |
+
from gradio.components.base import Component
|
| 463 |
+
|
| 464 |
+
|
| 465 |
+
class Microphone(components.Audio):
|
| 466 |
+
"""
|
| 467 |
+
Sets: sources=["microphone"]
|
| 468 |
+
"""
|
| 469 |
+
|
| 470 |
+
is_template = True
|
| 471 |
+
|
| 472 |
+
def __init__(
|
| 473 |
+
self,
|
| 474 |
+
value: str | Path | tuple[int, np.ndarray] | Callable | None = None,
|
| 475 |
+
*,
|
| 476 |
+
sources: (
|
| 477 |
+
list[Literal["upload", "microphone"]]
|
| 478 |
+
| Literal["upload", "microphone"]
|
| 479 |
+
| None
|
| 480 |
+
) = None,
|
| 481 |
+
type: Literal["numpy", "filepath"] = "numpy",
|
| 482 |
+
label: str | I18nData | None = None,
|
| 483 |
+
every: Timer | float | None = None,
|
| 484 |
+
inputs: (
|
| 485 |
+
components.Component
|
| 486 |
+
| Sequence[components.Component]
|
| 487 |
+
| set[components.Component]
|
| 488 |
+
| None
|
| 489 |
+
) = None,
|
| 490 |
+
show_label: bool | None = None,
|
| 491 |
+
container: bool = True,
|
| 492 |
+
scale: int | None = None,
|
| 493 |
+
min_width: int = 160,
|
| 494 |
+
interactive: bool | None = None,
|
| 495 |
+
visible: bool | Literal["hidden"] = True,
|
| 496 |
+
streaming: bool = False,
|
| 497 |
+
elem_id: str | None = None,
|
| 498 |
+
elem_classes: list[str] | str | None = None,
|
| 499 |
+
render: bool = True,
|
| 500 |
+
key: int | str | tuple[int | str, ...] | None = None,
|
| 501 |
+
preserved_by_key: list[str] | str | None = "value",
|
| 502 |
+
format: Literal["wav", "mp3"] = "wav",
|
| 503 |
+
autoplay: bool = False,
|
| 504 |
+
buttons: list[Literal["download", "share"]] | None = None,
|
| 505 |
+
editable: bool = True,
|
| 506 |
+
waveform_options: WaveformOptions | dict | None = None,
|
| 507 |
+
loop: bool = False,
|
| 508 |
+
recording: bool = False,
|
| 509 |
+
subtitles: str | Path | None = None,
|
| 510 |
+
playback_position: int = 0,
|
| 511 |
+
):
|
| 512 |
+
sources = ["microphone"]
|
| 513 |
+
super().__init__(
|
| 514 |
+
value,
|
| 515 |
+
sources=sources,
|
| 516 |
+
type=type,
|
| 517 |
+
label=label,
|
| 518 |
+
every=every,
|
| 519 |
+
inputs=inputs,
|
| 520 |
+
show_label=show_label,
|
| 521 |
+
container=container,
|
| 522 |
+
scale=scale,
|
| 523 |
+
min_width=min_width,
|
| 524 |
+
interactive=interactive,
|
| 525 |
+
visible=visible,
|
| 526 |
+
streaming=streaming,
|
| 527 |
+
elem_id=elem_id,
|
| 528 |
+
elem_classes=elem_classes,
|
| 529 |
+
render=render,
|
| 530 |
+
key=key,
|
| 531 |
+
preserved_by_key=preserved_by_key,
|
| 532 |
+
format=format,
|
| 533 |
+
autoplay=autoplay,
|
| 534 |
+
buttons=buttons, # type: ignore
|
| 535 |
+
editable=editable,
|
| 536 |
+
waveform_options=waveform_options,
|
| 537 |
+
loop=loop,
|
| 538 |
+
recording=recording,
|
| 539 |
+
subtitles=subtitles,
|
| 540 |
+
playback_position=playback_position,
|
| 541 |
+
)
|
| 542 |
+
from typing import Callable, Literal, Sequence, Any, TYPE_CHECKING
|
| 543 |
+
from gradio.blocks import Block
|
| 544 |
+
if TYPE_CHECKING:
|
| 545 |
+
from gradio.components import Timer
|
| 546 |
+
from gradio.components.base import Component
|
| 547 |
+
|
| 548 |
+
|
| 549 |
+
class Files(components.File):
|
| 550 |
+
"""
|
| 551 |
+
Sets: file_count="multiple"
|
| 552 |
+
"""
|
| 553 |
+
|
| 554 |
+
is_template = True
|
| 555 |
+
|
| 556 |
+
def __init__(
|
| 557 |
+
self,
|
| 558 |
+
value: str | list[str] | Callable | None = None,
|
| 559 |
+
*,
|
| 560 |
+
file_count: Literal["multiple"] = "multiple",
|
| 561 |
+
file_types: list[str] | None = None,
|
| 562 |
+
type: Literal["filepath", "binary"] = "filepath",
|
| 563 |
+
label: str | I18nData | None = None,
|
| 564 |
+
every: Timer | float | None = None,
|
| 565 |
+
inputs: (
|
| 566 |
+
components.Component
|
| 567 |
+
| Sequence[components.Component]
|
| 568 |
+
| set[components.Component]
|
| 569 |
+
| None
|
| 570 |
+
) = None,
|
| 571 |
+
show_label: bool | None = None,
|
| 572 |
+
container: bool = True,
|
| 573 |
+
scale: int | None = None,
|
| 574 |
+
min_width: int = 160,
|
| 575 |
+
height: int | float | None = None,
|
| 576 |
+
interactive: bool | None = None,
|
| 577 |
+
visible: bool | Literal["hidden"] = True,
|
| 578 |
+
elem_id: str | None = None,
|
| 579 |
+
elem_classes: list[str] | str | None = None,
|
| 580 |
+
render: bool = True,
|
| 581 |
+
key: int | str | tuple[int | str, ...] | None = None,
|
| 582 |
+
preserved_by_key: list[str] | str | None = "value",
|
| 583 |
+
allow_reordering: bool = False,
|
| 584 |
+
buttons: list[components.Button] | None = None,
|
| 585 |
+
):
|
| 586 |
+
super().__init__(
|
| 587 |
+
value,
|
| 588 |
+
file_count=file_count,
|
| 589 |
+
file_types=file_types,
|
| 590 |
+
type=type,
|
| 591 |
+
label=label,
|
| 592 |
+
every=every,
|
| 593 |
+
inputs=inputs,
|
| 594 |
+
show_label=show_label,
|
| 595 |
+
container=container,
|
| 596 |
+
scale=scale,
|
| 597 |
+
min_width=min_width,
|
| 598 |
+
height=height,
|
| 599 |
+
interactive=interactive,
|
| 600 |
+
visible=visible,
|
| 601 |
+
elem_id=elem_id,
|
| 602 |
+
elem_classes=elem_classes,
|
| 603 |
+
render=render,
|
| 604 |
+
key=key,
|
| 605 |
+
preserved_by_key=preserved_by_key,
|
| 606 |
+
buttons=buttons, # type: ignore
|
| 607 |
+
allow_reordering=allow_reordering,
|
| 608 |
+
)
|
| 609 |
+
from typing import Callable, Literal, Sequence, Any, TYPE_CHECKING
|
| 610 |
+
from gradio.blocks import Block
|
| 611 |
+
if TYPE_CHECKING:
|
| 612 |
+
from gradio.components import Timer
|
| 613 |
+
from gradio.components.base import Component
|
| 614 |
+
|
| 615 |
+
|
| 616 |
+
class Numpy(components.Dataframe):
|
| 617 |
+
"""
|
| 618 |
+
Sets: type="numpy"
|
| 619 |
+
"""
|
| 620 |
+
|
| 621 |
+
is_template = True
|
| 622 |
+
|
| 623 |
+
def __init__(
|
| 624 |
+
self,
|
| 625 |
+
value: list[list[Any]] | Callable | None = None,
|
| 626 |
+
*,
|
| 627 |
+
headers: list[str] | None = None,
|
| 628 |
+
row_count: int | tuple[int, str] = (1, "dynamic"),
|
| 629 |
+
row_limits: tuple[int | None, int | None] | None = None,
|
| 630 |
+
col_count: int | tuple[int, str] | None = None,
|
| 631 |
+
column_count: int | tuple[int, str] | None = None,
|
| 632 |
+
column_limits: tuple[int | None, int | None] | None = None,
|
| 633 |
+
datatype: (
|
| 634 |
+
Literal["str", "number", "bool", "date", "markdown", "html"]
|
| 635 |
+
| Sequence[Literal["str", "number", "bool", "date", "markdown", "html"]]
|
| 636 |
+
) = "str",
|
| 637 |
+
type: Literal["numpy"] = "numpy",
|
| 638 |
+
latex_delimiters: list[dict[str, str | bool]] | None = None,
|
| 639 |
+
label: str | I18nData | None = None,
|
| 640 |
+
show_label: bool | None = None,
|
| 641 |
+
every: Timer | float | None = None,
|
| 642 |
+
inputs: (
|
| 643 |
+
components.Component
|
| 644 |
+
| Sequence[components.Component]
|
| 645 |
+
| set[components.Component]
|
| 646 |
+
| None
|
| 647 |
+
) = None,
|
| 648 |
+
max_height: int = 500,
|
| 649 |
+
scale: int | None = None,
|
| 650 |
+
min_width: int = 160,
|
| 651 |
+
interactive: bool | None = None,
|
| 652 |
+
visible: bool | Literal["hidden"] = True,
|
| 653 |
+
elem_id: str | None = None,
|
| 654 |
+
elem_classes: list[str] | str | None = None,
|
| 655 |
+
render: bool = True,
|
| 656 |
+
key: int | str | tuple[int | str, ...] | None = None,
|
| 657 |
+
preserved_by_key: list[str] | str | None = "value",
|
| 658 |
+
wrap: bool = False,
|
| 659 |
+
line_breaks: bool = True,
|
| 660 |
+
column_widths: list[str | int] | None = None,
|
| 661 |
+
show_row_numbers: bool = False,
|
| 662 |
+
show_search: Literal["none", "search", "filter"] = "none",
|
| 663 |
+
static_columns: list[int] | None = None,
|
| 664 |
+
pinned_columns: int | None = None,
|
| 665 |
+
max_chars: int | None = None,
|
| 666 |
+
buttons: list[Literal["fullscreen", "copy"]] | None = None,
|
| 667 |
+
):
|
| 668 |
+
super().__init__(
|
| 669 |
+
value=value,
|
| 670 |
+
headers=headers,
|
| 671 |
+
row_count=row_count, # type: ignore
|
| 672 |
+
row_limits=row_limits,
|
| 673 |
+
col_count=col_count, # type: ignore
|
| 674 |
+
column_count=column_count, # type: ignore
|
| 675 |
+
column_limits=column_limits,
|
| 676 |
+
datatype=datatype,
|
| 677 |
+
type=type,
|
| 678 |
+
label=label,
|
| 679 |
+
show_label=show_label,
|
| 680 |
+
interactive=interactive,
|
| 681 |
+
visible=visible,
|
| 682 |
+
elem_id=elem_id,
|
| 683 |
+
wrap=wrap,
|
| 684 |
+
elem_classes=elem_classes,
|
| 685 |
+
render=render,
|
| 686 |
+
key=key,
|
| 687 |
+
preserved_by_key=preserved_by_key,
|
| 688 |
+
line_breaks=line_breaks,
|
| 689 |
+
column_widths=column_widths,
|
| 690 |
+
every=every,
|
| 691 |
+
inputs=inputs,
|
| 692 |
+
max_height=max_height,
|
| 693 |
+
scale=scale,
|
| 694 |
+
latex_delimiters=latex_delimiters,
|
| 695 |
+
min_width=min_width,
|
| 696 |
+
show_row_numbers=show_row_numbers,
|
| 697 |
+
show_search=show_search,
|
| 698 |
+
pinned_columns=pinned_columns,
|
| 699 |
+
buttons=buttons, # type: ignore
|
| 700 |
+
static_columns=static_columns,
|
| 701 |
+
max_chars=max_chars,
|
| 702 |
+
)
|
| 703 |
+
from typing import Callable, Literal, Sequence, Any, TYPE_CHECKING
|
| 704 |
+
from gradio.blocks import Block
|
| 705 |
+
if TYPE_CHECKING:
|
| 706 |
+
from gradio.components import Timer
|
| 707 |
+
from gradio.components.base import Component
|
| 708 |
+
|
| 709 |
+
|
| 710 |
+
class Matrix(components.Dataframe):
|
| 711 |
+
"""
|
| 712 |
+
Sets: type="array"
|
| 713 |
+
"""
|
| 714 |
+
|
| 715 |
+
is_template = True
|
| 716 |
+
|
| 717 |
+
def __init__(
|
| 718 |
+
self,
|
| 719 |
+
value: list[list[Any]] | Callable | None = None,
|
| 720 |
+
*,
|
| 721 |
+
headers: list[str] | None = None,
|
| 722 |
+
row_count: int | tuple[int, str] = (1, "dynamic"),
|
| 723 |
+
row_limits: tuple[int | None, int | None] | None = None,
|
| 724 |
+
col_count: int | tuple[int, str] | None = None,
|
| 725 |
+
column_count: int | tuple[int, str] | None = None,
|
| 726 |
+
column_limits: tuple[int | None, int | None] | None = None,
|
| 727 |
+
datatype: (
|
| 728 |
+
Literal["str", "number", "bool", "date", "markdown", "html"]
|
| 729 |
+
| Sequence[Literal["str", "number", "bool", "date", "markdown", "html"]]
|
| 730 |
+
) = "str",
|
| 731 |
+
type: Literal["array"] = "array",
|
| 732 |
+
latex_delimiters: list[dict[str, str | bool]] | None = None,
|
| 733 |
+
label: str | I18nData | None = None,
|
| 734 |
+
show_label: bool | None = None,
|
| 735 |
+
every: Timer | float | None = None,
|
| 736 |
+
inputs: (
|
| 737 |
+
components.Component
|
| 738 |
+
| Sequence[components.Component]
|
| 739 |
+
| set[components.Component]
|
| 740 |
+
| None
|
| 741 |
+
) = None,
|
| 742 |
+
max_height: int = 500,
|
| 743 |
+
scale: int | None = None,
|
| 744 |
+
min_width: int = 160,
|
| 745 |
+
interactive: bool | None = None,
|
| 746 |
+
visible: bool | Literal["hidden"] = True,
|
| 747 |
+
elem_id: str | None = None,
|
| 748 |
+
elem_classes: list[str] | str | None = None,
|
| 749 |
+
render: bool = True,
|
| 750 |
+
key: int | str | tuple[int | str, ...] | None = None,
|
| 751 |
+
preserved_by_key: list[str] | str | None = "value",
|
| 752 |
+
wrap: bool = False,
|
| 753 |
+
line_breaks: bool = True,
|
| 754 |
+
column_widths: list[str | int] | None = None,
|
| 755 |
+
show_row_numbers: bool = False,
|
| 756 |
+
show_search: Literal["none", "search", "filter"] = "none",
|
| 757 |
+
pinned_columns: int | None = None,
|
| 758 |
+
max_chars: int | None = None,
|
| 759 |
+
buttons: list[Literal["fullscreen", "copy"]] | None = None,
|
| 760 |
+
static_columns: list[int] | None = None,
|
| 761 |
+
):
|
| 762 |
+
super().__init__(
|
| 763 |
+
value=value,
|
| 764 |
+
headers=headers,
|
| 765 |
+
row_count=row_count, # type: ignore
|
| 766 |
+
row_limits=row_limits,
|
| 767 |
+
col_count=col_count, # type: ignore
|
| 768 |
+
column_count=column_count, # type: ignore
|
| 769 |
+
column_limits=column_limits,
|
| 770 |
+
datatype=datatype,
|
| 771 |
+
type=type,
|
| 772 |
+
label=label,
|
| 773 |
+
show_label=show_label,
|
| 774 |
+
interactive=interactive,
|
| 775 |
+
visible=visible,
|
| 776 |
+
elem_id=elem_id,
|
| 777 |
+
wrap=wrap,
|
| 778 |
+
elem_classes=elem_classes,
|
| 779 |
+
render=render,
|
| 780 |
+
key=key,
|
| 781 |
+
preserved_by_key=preserved_by_key,
|
| 782 |
+
line_breaks=line_breaks,
|
| 783 |
+
column_widths=column_widths,
|
| 784 |
+
every=every,
|
| 785 |
+
inputs=inputs,
|
| 786 |
+
max_height=max_height,
|
| 787 |
+
scale=scale,
|
| 788 |
+
latex_delimiters=latex_delimiters,
|
| 789 |
+
min_width=min_width,
|
| 790 |
+
show_row_numbers=show_row_numbers,
|
| 791 |
+
show_search=show_search,
|
| 792 |
+
pinned_columns=pinned_columns,
|
| 793 |
+
buttons=buttons, # type: ignore
|
| 794 |
+
static_columns=static_columns,
|
| 795 |
+
max_chars=max_chars,
|
| 796 |
+
)
|
| 797 |
+
from typing import Callable, Literal, Sequence, Any, TYPE_CHECKING
|
| 798 |
+
from gradio.blocks import Block
|
| 799 |
+
if TYPE_CHECKING:
|
| 800 |
+
from gradio.components import Timer
|
| 801 |
+
from gradio.components.base import Component
|
| 802 |
+
|
| 803 |
+
|
| 804 |
+
class List(components.Dataframe):
|
| 805 |
+
"""
|
| 806 |
+
Sets: type="array", col_count=1
|
| 807 |
+
"""
|
| 808 |
+
|
| 809 |
+
is_template = True
|
| 810 |
+
|
| 811 |
+
def __init__(
|
| 812 |
+
self,
|
| 813 |
+
value: list[list[Any]] | Callable | None = None,
|
| 814 |
+
*,
|
| 815 |
+
headers: list[str] | None = None,
|
| 816 |
+
row_count: int | tuple[int, str] = (1, "dynamic"),
|
| 817 |
+
row_limits: tuple[int | None, int | None] | None = None,
|
| 818 |
+
col_count: Literal[1] = 1,
|
| 819 |
+
column_count: Literal[1] | None = None,
|
| 820 |
+
column_limits: tuple[int | None, int | None] | None = None,
|
| 821 |
+
datatype: (
|
| 822 |
+
Literal["str", "number", "bool", "date", "markdown", "html"]
|
| 823 |
+
| Sequence[Literal["str", "number", "bool", "date", "markdown", "html"]]
|
| 824 |
+
) = "str",
|
| 825 |
+
type: Literal["array"] = "array",
|
| 826 |
+
latex_delimiters: list[dict[str, str | bool]] | None = None,
|
| 827 |
+
label: str | I18nData | None = None,
|
| 828 |
+
show_label: bool | None = None,
|
| 829 |
+
every: Timer | float | None = None,
|
| 830 |
+
inputs: (
|
| 831 |
+
components.Component
|
| 832 |
+
| Sequence[components.Component]
|
| 833 |
+
| set[components.Component]
|
| 834 |
+
| None
|
| 835 |
+
) = None,
|
| 836 |
+
max_height: int = 500,
|
| 837 |
+
scale: int | None = None,
|
| 838 |
+
min_width: int = 160,
|
| 839 |
+
interactive: bool | None = None,
|
| 840 |
+
visible: bool | Literal["hidden"] = True,
|
| 841 |
+
elem_id: str | None = None,
|
| 842 |
+
elem_classes: list[str] | str | None = None,
|
| 843 |
+
render: bool = True,
|
| 844 |
+
key: int | str | tuple[int | str, ...] | None = None,
|
| 845 |
+
preserved_by_key: list[str] | str | None = "value",
|
| 846 |
+
wrap: bool = False,
|
| 847 |
+
line_breaks: bool = True,
|
| 848 |
+
column_widths: list[str | int] | None = None,
|
| 849 |
+
show_row_numbers: bool = False,
|
| 850 |
+
show_search: Literal["none", "search", "filter"] = "none",
|
| 851 |
+
pinned_columns: int | None = None,
|
| 852 |
+
max_chars: int | None = None,
|
| 853 |
+
buttons: list[Literal["fullscreen", "copy"]] | None = None,
|
| 854 |
+
static_columns: list[int] | None = None,
|
| 855 |
+
):
|
| 856 |
+
super().__init__(
|
| 857 |
+
value=value,
|
| 858 |
+
headers=headers,
|
| 859 |
+
row_count=row_count, # type: ignore
|
| 860 |
+
row_limits=row_limits,
|
| 861 |
+
col_count=col_count, # type: ignore
|
| 862 |
+
column_count=column_count, # type: ignore
|
| 863 |
+
column_limits=column_limits,
|
| 864 |
+
datatype=datatype,
|
| 865 |
+
type=type,
|
| 866 |
+
label=label,
|
| 867 |
+
show_label=show_label,
|
| 868 |
+
interactive=interactive,
|
| 869 |
+
visible=visible,
|
| 870 |
+
elem_id=elem_id,
|
| 871 |
+
wrap=wrap,
|
| 872 |
+
elem_classes=elem_classes,
|
| 873 |
+
render=render,
|
| 874 |
+
key=key,
|
| 875 |
+
preserved_by_key=preserved_by_key,
|
| 876 |
+
line_breaks=line_breaks,
|
| 877 |
+
column_widths=column_widths,
|
| 878 |
+
every=every,
|
| 879 |
+
inputs=inputs,
|
| 880 |
+
max_height=max_height,
|
| 881 |
+
scale=scale,
|
| 882 |
+
latex_delimiters=latex_delimiters,
|
| 883 |
+
min_width=min_width,
|
| 884 |
+
show_row_numbers=show_row_numbers,
|
| 885 |
+
show_search=show_search,
|
| 886 |
+
static_columns=static_columns,
|
| 887 |
+
pinned_columns=pinned_columns,
|
| 888 |
+
buttons=buttons, # type: ignore
|
| 889 |
+
max_chars=max_chars,
|
| 890 |
+
)
|
| 891 |
+
from typing import Callable, Literal, Sequence, Any, TYPE_CHECKING
|
| 892 |
+
from gradio.blocks import Block
|
| 893 |
+
if TYPE_CHECKING:
|
| 894 |
+
from gradio.components import Timer
|
| 895 |
+
from gradio.components.base import Component
|
| 896 |
+
|
| 897 |
+
|
| 898 |
+
Mic = Microphone
|
`/Agents/influencer-thread-pipeline/.venv/Lib/site-packages/gradio/templates/node/build/node_modules/follow-redirects/LICENSE
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Copyright 2014–present Olivier Lalonde <olalonde@gmail.com>, James Talmage <james@talmage.io>, Ruben Verborgh
|
| 2 |
+
|
| 3 |
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
| 4 |
+
this software and associated documentation files (the "Software"), to deal in
|
| 5 |
+
the Software without restriction, including without limitation the rights to
|
| 6 |
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
| 7 |
+
of the Software, and to permit persons to whom the Software is furnished to do
|
| 8 |
+
so, subject to the following conditions:
|
| 9 |
+
|
| 10 |
+
The above copyright notice and this permission notice shall be included in all
|
| 11 |
+
copies or substantial portions of the Software.
|
| 12 |
+
|
| 13 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
| 14 |
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
| 15 |
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
| 16 |
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
| 17 |
+
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
|
| 18 |
+
IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
`/Agents/influencer-thread-pipeline/.venv/Lib/site-packages/gradio/templates/node/build/node_modules/follow-redirects/README.md
ADDED
|
@@ -0,0 +1,157 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
## Follow Redirects
|
| 2 |
+
|
| 3 |
+
Drop-in replacement for Node's `http` and `https` modules that automatically follows redirects.
|
| 4 |
+
|
| 5 |
+
[](https://www.npmjs.com/package/follow-redirects)
|
| 6 |
+
[](https://github.com/follow-redirects/follow-redirects/actions)
|
| 7 |
+
[](https://coveralls.io/r/follow-redirects/follow-redirects?branch=master)
|
| 8 |
+
[](https://www.npmjs.com/package/follow-redirects)
|
| 9 |
+
[](https://github.com/sponsors/RubenVerborgh)
|
| 10 |
+
|
| 11 |
+
`follow-redirects` provides [request](https://nodejs.org/api/http.html#http_http_request_options_callback) and [get](https://nodejs.org/api/http.html#http_http_get_options_callback)
|
| 12 |
+
methods that behave identically to those found on the native [http](https://nodejs.org/api/http.html#http_http_request_options_callback) and [https](https://nodejs.org/api/https.html#https_https_request_options_callback)
|
| 13 |
+
modules, with the exception that they will seamlessly follow redirects.
|
| 14 |
+
|
| 15 |
+
```javascript
|
| 16 |
+
const { http, https } = require('follow-redirects');
|
| 17 |
+
|
| 18 |
+
http.get('http://en.wikipedia.org/', response => {
|
| 19 |
+
response.on('data', chunk => {
|
| 20 |
+
console.log(chunk);
|
| 21 |
+
});
|
| 22 |
+
}).on('error', err => {
|
| 23 |
+
console.error(err);
|
| 24 |
+
});
|
| 25 |
+
```
|
| 26 |
+
|
| 27 |
+
You can inspect the final redirected URL through the `responseUrl` property on the `response`.
|
| 28 |
+
If no redirection happened, `responseUrl` is the original request URL.
|
| 29 |
+
|
| 30 |
+
```javascript
|
| 31 |
+
const request = https.request({
|
| 32 |
+
host: 'en.wikipedia.org',
|
| 33 |
+
path: '/',
|
| 34 |
+
}, response => {
|
| 35 |
+
console.log(response.responseUrl);
|
| 36 |
+
// 'http://duckduckgo.com/robots.txt'
|
| 37 |
+
});
|
| 38 |
+
request.end();
|
| 39 |
+
```
|
| 40 |
+
|
| 41 |
+
## Options
|
| 42 |
+
### Global options
|
| 43 |
+
Global options are set directly on the `follow-redirects` module:
|
| 44 |
+
|
| 45 |
+
```javascript
|
| 46 |
+
const followRedirects = require('follow-redirects');
|
| 47 |
+
followRedirects.maxRedirects = 10;
|
| 48 |
+
followRedirects.maxBodyLength = 20 * 1024 * 1024; // 20 MB
|
| 49 |
+
```
|
| 50 |
+
|
| 51 |
+
The following global options are supported:
|
| 52 |
+
|
| 53 |
+
- `maxRedirects` (default: `21`) – sets the maximum number of allowed redirects; if exceeded, an error will be emitted.
|
| 54 |
+
|
| 55 |
+
- `maxBodyLength` (default: 10MB) – sets the maximum size of the request body; if exceeded, an error will be emitted.
|
| 56 |
+
|
| 57 |
+
### Per-request options
|
| 58 |
+
Per-request options are set by passing an `options` object:
|
| 59 |
+
|
| 60 |
+
```javascript
|
| 61 |
+
const url = require('url');
|
| 62 |
+
const { http, https } = require('follow-redirects');
|
| 63 |
+
|
| 64 |
+
const options = url.parse('http://en.wikipedia.org/');
|
| 65 |
+
options.maxRedirects = 10;
|
| 66 |
+
options.beforeRedirect = (options, response, request) => {
|
| 67 |
+
// Use this to adjust the request options upon redirecting,
|
| 68 |
+
// to inspect the latest response headers,
|
| 69 |
+
// or to cancel the request by throwing an error
|
| 70 |
+
|
| 71 |
+
// response.headers = the redirect response headers
|
| 72 |
+
// response.statusCode = the redirect response code (eg. 301, 307, etc.)
|
| 73 |
+
|
| 74 |
+
// request.url = the requested URL that resulted in a redirect
|
| 75 |
+
// request.headers = the headers in the request that resulted in a redirect
|
| 76 |
+
// request.method = the method of the request that resulted in a redirect
|
| 77 |
+
if (options.hostname === "example.org") {
|
| 78 |
+
options.auth = "user:password";
|
| 79 |
+
}
|
| 80 |
+
};
|
| 81 |
+
http.request(options);
|
| 82 |
+
```
|
| 83 |
+
|
| 84 |
+
In addition to the [standard HTTP](https://nodejs.org/api/http.html#http_http_request_options_callback) and [HTTPS options](https://nodejs.org/api/https.html#https_https_request_options_callback),
|
| 85 |
+
the following per-request options are supported:
|
| 86 |
+
- `followRedirects` (default: `true`) – whether redirects should be followed.
|
| 87 |
+
|
| 88 |
+
- `maxRedirects` (default: `21`) – sets the maximum number of allowed redirects; if exceeded, an error will be emitted.
|
| 89 |
+
|
| 90 |
+
- `maxBodyLength` (default: 10MB) – sets the maximum size of the request body; if exceeded, an error will be emitted.
|
| 91 |
+
|
| 92 |
+
- `beforeRedirect` (default: `undefined`) – optionally change the request `options` on redirects, or abort the request by throwing an error.
|
| 93 |
+
|
| 94 |
+
- `agents` (default: `undefined`) – sets the `agent` option per protocol, since HTTP and HTTPS use different agents. Example value: `{ http: new http.Agent(), https: new https.Agent() }`
|
| 95 |
+
|
| 96 |
+
- `trackRedirects` (default: `false`) – whether to store the redirected response details into the `redirects` array on the response object.
|
| 97 |
+
|
| 98 |
+
- `sensitiveHeaders` (default: `[]`) – names of headers to omit when making redirected requests (such as `X-API-Key`, `X-Auth-Token`…)
|
| 99 |
+
|
| 100 |
+
|
| 101 |
+
### Advanced usage
|
| 102 |
+
By default, `follow-redirects` will use the Node.js default implementations
|
| 103 |
+
of [`http`](https://nodejs.org/api/http.html)
|
| 104 |
+
and [`https`](https://nodejs.org/api/https.html).
|
| 105 |
+
To enable features such as caching and/or intermediate request tracking,
|
| 106 |
+
you might instead want to wrap `follow-redirects` around custom protocol implementations:
|
| 107 |
+
|
| 108 |
+
```javascript
|
| 109 |
+
const { http, https } = require('follow-redirects').wrap({
|
| 110 |
+
http: require('your-custom-http'),
|
| 111 |
+
https: require('your-custom-https'),
|
| 112 |
+
});
|
| 113 |
+
```
|
| 114 |
+
|
| 115 |
+
Such custom protocols only need an implementation of the `request` method.
|
| 116 |
+
|
| 117 |
+
## Browser Usage
|
| 118 |
+
|
| 119 |
+
Due to the way the browser works,
|
| 120 |
+
the `http` and `https` browser equivalents perform redirects by default.
|
| 121 |
+
|
| 122 |
+
By requiring `follow-redirects` this way:
|
| 123 |
+
```javascript
|
| 124 |
+
const http = require('follow-redirects/http');
|
| 125 |
+
const https = require('follow-redirects/https');
|
| 126 |
+
```
|
| 127 |
+
you can easily tell webpack and friends to replace
|
| 128 |
+
`follow-redirect` by the built-in versions:
|
| 129 |
+
|
| 130 |
+
```json
|
| 131 |
+
{
|
| 132 |
+
"follow-redirects/http" : "http",
|
| 133 |
+
"follow-redirects/https" : "https"
|
| 134 |
+
}
|
| 135 |
+
```
|
| 136 |
+
|
| 137 |
+
## Contributing
|
| 138 |
+
|
| 139 |
+
Pull Requests are always welcome. Please [file an issue](https://github.com/follow-redirects/follow-redirects/issues)
|
| 140 |
+
detailing your proposal before you invest your valuable time. Additional features and bug fixes should be accompanied
|
| 141 |
+
by tests. You can run the test suite locally with a simple `npm test` command.
|
| 142 |
+
|
| 143 |
+
## Debug Logging
|
| 144 |
+
|
| 145 |
+
`follow-redirects` uses the excellent [debug](https://www.npmjs.com/package/debug) for logging. To turn on logging
|
| 146 |
+
set the environment variable `DEBUG=follow-redirects` for debug output from just this module. When running the test
|
| 147 |
+
suite it is sometimes advantageous to set `DEBUG=*` to see output from the express server as well.
|
| 148 |
+
|
| 149 |
+
## Authors
|
| 150 |
+
|
| 151 |
+
- [Ruben Verborgh](https://ruben.verborgh.org/)
|
| 152 |
+
- [Olivier Lalonde](mailto:olalonde@gmail.com)
|
| 153 |
+
- [James Talmage](mailto:james@talmage.io)
|
| 154 |
+
|
| 155 |
+
## License
|
| 156 |
+
|
| 157 |
+
[MIT License](https://github.com/follow-redirects/follow-redirects/blob/master/LICENSE)
|
`/Agents/influencer-thread-pipeline/.venv/Lib/site-packages/gradio/templates/node/build/node_modules/follow-redirects/package.json
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"name": "follow-redirects",
|
| 3 |
+
"version": "1.16.0",
|
| 4 |
+
"description": "HTTP and HTTPS modules that follow redirects.",
|
| 5 |
+
"license": "MIT",
|
| 6 |
+
"main": "index.js",
|
| 7 |
+
"files": [
|
| 8 |
+
"*.js"
|
| 9 |
+
],
|
| 10 |
+
"engines": {
|
| 11 |
+
"node": ">=4.0"
|
| 12 |
+
},
|
| 13 |
+
"scripts": {
|
| 14 |
+
"lint": "eslint *.js test",
|
| 15 |
+
"test": "nyc mocha"
|
| 16 |
+
},
|
| 17 |
+
"repository": {
|
| 18 |
+
"type": "git",
|
| 19 |
+
"url": "git+ssh://git@github.com/follow-redirects/follow-redirects.git"
|
| 20 |
+
},
|
| 21 |
+
"homepage": "https://github.com/follow-redirects/follow-redirects",
|
| 22 |
+
"bugs": {
|
| 23 |
+
"url": "https://github.com/follow-redirects/follow-redirects/issues"
|
| 24 |
+
},
|
| 25 |
+
"keywords": [
|
| 26 |
+
"http",
|
| 27 |
+
"https",
|
| 28 |
+
"url",
|
| 29 |
+
"redirect",
|
| 30 |
+
"client",
|
| 31 |
+
"location",
|
| 32 |
+
"utility"
|
| 33 |
+
],
|
| 34 |
+
"author": "Ruben Verborgh <ruben@verborgh.org> (https://ruben.verborgh.org/)",
|
| 35 |
+
"contributors": [
|
| 36 |
+
"Olivier Lalonde <olalonde@gmail.com> (http://www.syskall.com)",
|
| 37 |
+
"James Talmage <james@talmage.io>"
|
| 38 |
+
],
|
| 39 |
+
"funding": [
|
| 40 |
+
{
|
| 41 |
+
"type": "individual",
|
| 42 |
+
"url": "https://github.com/sponsors/RubenVerborgh"
|
| 43 |
+
}
|
| 44 |
+
],
|
| 45 |
+
"peerDependenciesMeta": {
|
| 46 |
+
"debug": {
|
| 47 |
+
"optional": true
|
| 48 |
+
}
|
| 49 |
+
},
|
| 50 |
+
"devDependencies": {
|
| 51 |
+
"concat-stream": "^2.0.0",
|
| 52 |
+
"eslint": "^5.16.0",
|
| 53 |
+
"express": "^4.16.4",
|
| 54 |
+
"lolex": "^3.1.0",
|
| 55 |
+
"mocha": "^6.0.2",
|
| 56 |
+
"nyc": "^14.1.1"
|
| 57 |
+
}
|
| 58 |
+
}
|
`/Agents/influencer-thread-pipeline/.venv/Lib/site-packages/gradio/templates/node/build/node_modules/http-proxy/.auto-changelog
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"output": "CHANGELOG.md",
|
| 3 |
+
"template": "keepachangelog",
|
| 4 |
+
"unreleased": true,
|
| 5 |
+
"commitLimit": false
|
| 6 |
+
}
|
`/Agents/influencer-thread-pipeline/.venv/Lib/site-packages/gradio/templates/node/build/node_modules/http-proxy/.gitattributes
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
package-lock.json binary
|
`/Agents/influencer-thread-pipeline/.venv/Lib/site-packages/gradio/templates/node/build/node_modules/http-proxy/CHANGELOG.md
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
`/Agents/influencer-thread-pipeline/.venv/Lib/site-packages/gradio/templates/node/build/node_modules/http-proxy/CODE_OF_CONDUCT.md
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Contributor Covenant Code of Conduct
|
| 2 |
+
|
| 3 |
+
## Our Pledge
|
| 4 |
+
|
| 5 |
+
In the interest of fostering an open and welcoming environment, we as
|
| 6 |
+
contributors and maintainers pledge to making participation in our project and
|
| 7 |
+
our community a harassment-free experience for everyone, regardless of age, body
|
| 8 |
+
size, disability, ethnicity, gender identity and expression, level of experience,
|
| 9 |
+
nationality, personal appearance, race, religion, or sexual identity and
|
| 10 |
+
orientation.
|
| 11 |
+
|
| 12 |
+
## Our Standards
|
| 13 |
+
|
| 14 |
+
Examples of behavior that contributes to creating a positive environment
|
| 15 |
+
include:
|
| 16 |
+
|
| 17 |
+
* Using welcoming and inclusive language
|
| 18 |
+
* Being respectful of differing viewpoints and experiences
|
| 19 |
+
* Gracefully accepting constructive criticism
|
| 20 |
+
* Focusing on what is best for the community
|
| 21 |
+
* Showing empathy towards other community members
|
| 22 |
+
|
| 23 |
+
Examples of unacceptable behavior by participants include:
|
| 24 |
+
|
| 25 |
+
* The use of sexualized language or imagery and unwelcome sexual attention or
|
| 26 |
+
advances
|
| 27 |
+
* Trolling, insulting/derogatory comments, and personal or political attacks
|
| 28 |
+
* Public or private harassment
|
| 29 |
+
* Publishing others' private information, such as a physical or electronic
|
| 30 |
+
address, without explicit permission
|
| 31 |
+
* Other conduct which could reasonably be considered inappropriate in a
|
| 32 |
+
professional setting
|
| 33 |
+
|
| 34 |
+
## Our Responsibilities
|
| 35 |
+
|
| 36 |
+
Project maintainers are responsible for clarifying the standards of acceptable
|
| 37 |
+
behavior and are expected to take appropriate and fair corrective action in
|
| 38 |
+
response to any instances of unacceptable behavior.
|
| 39 |
+
|
| 40 |
+
Project maintainers have the right and responsibility to remove, edit, or
|
| 41 |
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
| 42 |
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
| 43 |
+
permanently any contributor for other behaviors that they deem inappropriate,
|
| 44 |
+
threatening, offensive, or harmful.
|
| 45 |
+
|
| 46 |
+
## Scope
|
| 47 |
+
|
| 48 |
+
This Code of Conduct applies both within project spaces and in public spaces
|
| 49 |
+
when an individual is representing the project or its community. Examples of
|
| 50 |
+
representing a project or community include using an official project e-mail
|
| 51 |
+
address, posting via an official social media account, or acting as an appointed
|
| 52 |
+
representative at an online or offline event. Representation of a project may be
|
| 53 |
+
further defined and clarified by project maintainers.
|
| 54 |
+
|
| 55 |
+
## Enforcement
|
| 56 |
+
|
| 57 |
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
| 58 |
+
reported by contacting the project team at <https://github.com/http-party/node-http-proxy>. All
|
| 59 |
+
complaints will be reviewed and investigated and will result in a response that
|
| 60 |
+
is deemed necessary and appropriate to the circumstances. The project team is
|
| 61 |
+
obligated to maintain confidentiality with regard to the reporter of an incident.
|
| 62 |
+
Further details of specific enforcement policies may be posted separately.
|
| 63 |
+
|
| 64 |
+
Project maintainers who do not follow or enforce the Code of Conduct in good
|
| 65 |
+
faith may face temporary or permanent repercussions as determined by other
|
| 66 |
+
members of the project's leadership.
|
| 67 |
+
|
| 68 |
+
## Attribution
|
| 69 |
+
|
| 70 |
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
| 71 |
+
available at [http://contributor-covenant.org/version/1/4][version]
|
| 72 |
+
|
| 73 |
+
[homepage]: http://contributor-covenant.org
|
| 74 |
+
[version]: http://contributor-covenant.org/version/1/4/
|
`/Agents/influencer-thread-pipeline/.venv/Lib/site-packages/gradio/templates/node/build/node_modules/http-proxy/LICENSE
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
node-http-proxy
|
| 3 |
+
|
| 4 |
+
Copyright (c) 2010-2016 Charlie Robbins, Jarrett Cruger & the Contributors.
|
| 5 |
+
|
| 6 |
+
Permission is hereby granted, free of charge, to any person obtaining
|
| 7 |
+
a copy of this software and associated documentation files (the
|
| 8 |
+
"Software"), to deal in the Software without restriction, including
|
| 9 |
+
without limitation the rights to use, copy, modify, merge, publish,
|
| 10 |
+
distribute, sublicense, and/or sell copies of the Software, and to
|
| 11 |
+
permit persons to whom the Software is furnished to do so, subject to
|
| 12 |
+
the following conditions:
|
| 13 |
+
|
| 14 |
+
The above copyright notice and this permission notice shall be
|
| 15 |
+
included in all copies or substantial portions of the Software.
|
| 16 |
+
|
| 17 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
| 18 |
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
| 19 |
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
| 20 |
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
| 21 |
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
| 22 |
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
| 23 |
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
`/Agents/influencer-thread-pipeline/.venv/Lib/site-packages/gradio/templates/node/build/node_modules/http-proxy/README.md
ADDED
|
@@ -0,0 +1,568 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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master/doc/logo.png"/>
|
| 3 |
+
</p>
|
| 4 |
+
|
| 5 |
+
# node-http-proxy [](https://travis-ci.org/http-party/node-http-proxy) [](https://codecov.io/gh/http-party/node-http-proxy)
|
| 6 |
+
|
| 7 |
+
`node-http-proxy` is an HTTP programmable proxying library that supports
|
| 8 |
+
websockets. It is suitable for implementing components such as reverse
|
| 9 |
+
proxies and load balancers.
|
| 10 |
+
|
| 11 |
+
### Table of Contents
|
| 12 |
+
* [Installation](#installation)
|
| 13 |
+
* [Upgrading from 0.8.x ?](#upgrading-from-08x-)
|
| 14 |
+
* [Core Concept](#core-concept)
|
| 15 |
+
* [Use Cases](#use-cases)
|
| 16 |
+
* [Setup a basic stand-alone proxy server](#setup-a-basic-stand-alone-proxy-server)
|
| 17 |
+
* [Setup a stand-alone proxy server with custom server logic](#setup-a-stand-alone-proxy-server-with-custom-server-logic)
|
| 18 |
+
* [Setup a stand-alone proxy server with proxy request header re-writing](#setup-a-stand-alone-proxy-server-with-proxy-request-header-re-writing)
|
| 19 |
+
* [Modify a response from a proxied server](#modify-a-response-from-a-proxied-server)
|
| 20 |
+
* [Setup a stand-alone proxy server with latency](#setup-a-stand-alone-proxy-server-with-latency)
|
| 21 |
+
* [Using HTTPS](#using-https)
|
| 22 |
+
* [Proxying WebSockets](#proxying-websockets)
|
| 23 |
+
* [Options](#options)
|
| 24 |
+
* [Listening for proxy events](#listening-for-proxy-events)
|
| 25 |
+
* [Shutdown](#shutdown)
|
| 26 |
+
* [Miscellaneous](#miscellaneous)
|
| 27 |
+
* [Test](#test)
|
| 28 |
+
* [ProxyTable API](#proxytable-api)
|
| 29 |
+
* [Logo](#logo)
|
| 30 |
+
* [Contributing and Issues](#contributing-and-issues)
|
| 31 |
+
* [License](#license)
|
| 32 |
+
|
| 33 |
+
### Installation
|
| 34 |
+
|
| 35 |
+
`npm install http-proxy --save`
|
| 36 |
+
|
| 37 |
+
**[Back to top](#table-of-contents)**
|
| 38 |
+
|
| 39 |
+
### Upgrading from 0.8.x ?
|
| 40 |
+
|
| 41 |
+
Click [here](UPGRADING.md)
|
| 42 |
+
|
| 43 |
+
**[Back to top](#table-of-contents)**
|
| 44 |
+
|
| 45 |
+
### Core Concept
|
| 46 |
+
|
| 47 |
+
A new proxy is created by calling `createProxyServer` and passing
|
| 48 |
+
an `options` object as argument ([valid properties are available here](lib/http-proxy.js#L26-L42))
|
| 49 |
+
|
| 50 |
+
```javascript
|
| 51 |
+
var httpProxy = require('http-proxy');
|
| 52 |
+
|
| 53 |
+
var proxy = httpProxy.createProxyServer(options); // See (†)
|
| 54 |
+
```
|
| 55 |
+
†Unless listen(..) is invoked on the object, this does not create a webserver. See below.
|
| 56 |
+
|
| 57 |
+
An object will be returned with four methods:
|
| 58 |
+
|
| 59 |
+
* web `req, res, [options]` (used for proxying regular HTTP(S) requests)
|
| 60 |
+
* ws `req, socket, head, [options]` (used for proxying WS(S) requests)
|
| 61 |
+
* listen `port` (a function that wraps the object in a webserver, for your convenience)
|
| 62 |
+
* close `[callback]` (a function that closes the inner webserver and stops listening on given port)
|
| 63 |
+
|
| 64 |
+
It is then possible to proxy requests by calling these functions
|
| 65 |
+
|
| 66 |
+
```javascript
|
| 67 |
+
http.createServer(function(req, res) {
|
| 68 |
+
proxy.web(req, res, { target: 'http://mytarget.com:8080' });
|
| 69 |
+
});
|
| 70 |
+
```
|
| 71 |
+
|
| 72 |
+
Errors can be listened on either using the Event Emitter API
|
| 73 |
+
|
| 74 |
+
```javascript
|
| 75 |
+
proxy.on('error', function(e) {
|
| 76 |
+
...
|
| 77 |
+
});
|
| 78 |
+
```
|
| 79 |
+
|
| 80 |
+
or using the callback API
|
| 81 |
+
|
| 82 |
+
```javascript
|
| 83 |
+
proxy.web(req, res, { target: 'http://mytarget.com:8080' }, function(e) { ... });
|
| 84 |
+
```
|
| 85 |
+
|
| 86 |
+
When a request is proxied it follows two different pipelines ([available here](lib/http-proxy/passes))
|
| 87 |
+
which apply transformations to both the `req` and `res` object.
|
| 88 |
+
The first pipeline (incoming) is responsible for the creation and manipulation of the stream that connects your client to the target.
|
| 89 |
+
The second pipeline (outgoing) is responsible for the creation and manipulation of the stream that, from your target, returns data
|
| 90 |
+
to the client.
|
| 91 |
+
|
| 92 |
+
**[Back to top](#table-of-contents)**
|
| 93 |
+
|
| 94 |
+
### Use Cases
|
| 95 |
+
|
| 96 |
+
#### Setup a basic stand-alone proxy server
|
| 97 |
+
|
| 98 |
+
```js
|
| 99 |
+
var http = require('http'),
|
| 100 |
+
httpProxy = require('http-proxy');
|
| 101 |
+
//
|
| 102 |
+
// Create your proxy server and set the target in the options.
|
| 103 |
+
//
|
| 104 |
+
httpProxy.createProxyServer({target:'http://localhost:9000'}).listen(8000); // See (†)
|
| 105 |
+
|
| 106 |
+
//
|
| 107 |
+
// Create your target server
|
| 108 |
+
//
|
| 109 |
+
http.createServer(function (req, res) {
|
| 110 |
+
res.writeHead(200, { 'Content-Type': 'text/plain' });
|
| 111 |
+
res.write('request successfully proxied!' + '\n' + JSON.stringify(req.headers, true, 2));
|
| 112 |
+
res.end();
|
| 113 |
+
}).listen(9000);
|
| 114 |
+
```
|
| 115 |
+
†Invoking listen(..) triggers the creation of a web server. Otherwise, just the proxy instance is created.
|
| 116 |
+
|
| 117 |
+
**[Back to top](#table-of-contents)**
|
| 118 |
+
|
| 119 |
+
#### Setup a stand-alone proxy server with custom server logic
|
| 120 |
+
This example shows how you can proxy a request using your own HTTP server
|
| 121 |
+
and also you can put your own logic to handle the request.
|
| 122 |
+
|
| 123 |
+
```js
|
| 124 |
+
var http = require('http'),
|
| 125 |
+
httpProxy = require('http-proxy');
|
| 126 |
+
|
| 127 |
+
//
|
| 128 |
+
// Create a proxy server with custom application logic
|
| 129 |
+
//
|
| 130 |
+
var proxy = httpProxy.createProxyServer({});
|
| 131 |
+
|
| 132 |
+
//
|
| 133 |
+
// Create your custom server and just call `proxy.web()` to proxy
|
| 134 |
+
// a web request to the target passed in the options
|
| 135 |
+
// also you can use `proxy.ws()` to proxy a websockets request
|
| 136 |
+
//
|
| 137 |
+
var server = http.createServer(function(req, res) {
|
| 138 |
+
// You can define here your custom logic to handle the request
|
| 139 |
+
// and then proxy the request.
|
| 140 |
+
proxy.web(req, res, { target: 'http://127.0.0.1:5050' });
|
| 141 |
+
});
|
| 142 |
+
|
| 143 |
+
console.log("listening on port 5050")
|
| 144 |
+
server.listen(5050);
|
| 145 |
+
```
|
| 146 |
+
|
| 147 |
+
**[Back to top](#table-of-contents)**
|
| 148 |
+
|
| 149 |
+
#### Setup a stand-alone proxy server with proxy request header re-writing
|
| 150 |
+
This example shows how you can proxy a request using your own HTTP server that
|
| 151 |
+
modifies the outgoing proxy request by adding a special header.
|
| 152 |
+
|
| 153 |
+
```js
|
| 154 |
+
var http = require('http'),
|
| 155 |
+
httpProxy = require('http-proxy');
|
| 156 |
+
|
| 157 |
+
//
|
| 158 |
+
// Create a proxy server with custom application logic
|
| 159 |
+
//
|
| 160 |
+
var proxy = httpProxy.createProxyServer({});
|
| 161 |
+
|
| 162 |
+
// To modify the proxy connection before data is sent, you can listen
|
| 163 |
+
// for the 'proxyReq' event. When the event is fired, you will receive
|
| 164 |
+
// the following arguments:
|
| 165 |
+
// (http.ClientRequest proxyReq, http.IncomingMessage req,
|
| 166 |
+
// http.ServerResponse res, Object options). This mechanism is useful when
|
| 167 |
+
// you need to modify the proxy request before the proxy connection
|
| 168 |
+
// is made to the target.
|
| 169 |
+
//
|
| 170 |
+
proxy.on('proxyReq', function(proxyReq, req, res, options) {
|
| 171 |
+
proxyReq.setHeader('X-Special-Proxy-Header', 'foobar');
|
| 172 |
+
});
|
| 173 |
+
|
| 174 |
+
var server = http.createServer(function(req, res) {
|
| 175 |
+
// You can define here your custom logic to handle the request
|
| 176 |
+
// and then proxy the request.
|
| 177 |
+
proxy.web(req, res, {
|
| 178 |
+
target: 'http://127.0.0.1:5050'
|
| 179 |
+
});
|
| 180 |
+
});
|
| 181 |
+
|
| 182 |
+
console.log("listening on port 5050")
|
| 183 |
+
server.listen(5050);
|
| 184 |
+
```
|
| 185 |
+
|
| 186 |
+
**[Back to top](#table-of-contents)**
|
| 187 |
+
|
| 188 |
+
#### Modify a response from a proxied server
|
| 189 |
+
Sometimes when you have received a HTML/XML document from the server of origin you would like to modify it before forwarding it on.
|
| 190 |
+
|
| 191 |
+
[Harmon](https://github.com/No9/harmon) allows you to do this in a streaming style so as to keep the pressure on the proxy to a minimum.
|
| 192 |
+
|
| 193 |
+
**[Back to top](#table-of-contents)**
|
| 194 |
+
|
| 195 |
+
#### Setup a stand-alone proxy server with latency
|
| 196 |
+
|
| 197 |
+
```js
|
| 198 |
+
var http = require('http'),
|
| 199 |
+
httpProxy = require('http-proxy');
|
| 200 |
+
|
| 201 |
+
//
|
| 202 |
+
// Create a proxy server with latency
|
| 203 |
+
//
|
| 204 |
+
var proxy = httpProxy.createProxyServer();
|
| 205 |
+
|
| 206 |
+
//
|
| 207 |
+
// Create your server that makes an operation that waits a while
|
| 208 |
+
// and then proxies the request
|
| 209 |
+
//
|
| 210 |
+
http.createServer(function (req, res) {
|
| 211 |
+
// This simulates an operation that takes 500ms to execute
|
| 212 |
+
setTimeout(function () {
|
| 213 |
+
proxy.web(req, res, {
|
| 214 |
+
target: 'http://localhost:9008'
|
| 215 |
+
});
|
| 216 |
+
}, 500);
|
| 217 |
+
}).listen(8008);
|
| 218 |
+
|
| 219 |
+
//
|
| 220 |
+
// Create your target server
|
| 221 |
+
//
|
| 222 |
+
http.createServer(function (req, res) {
|
| 223 |
+
res.writeHead(200, { 'Content-Type': 'text/plain' });
|
| 224 |
+
res.write('request successfully proxied to: ' + req.url + '\n' + JSON.stringify(req.headers, true, 2));
|
| 225 |
+
res.end();
|
| 226 |
+
}).listen(9008);
|
| 227 |
+
```
|
| 228 |
+
|
| 229 |
+
**[Back to top](#table-of-contents)**
|
| 230 |
+
|
| 231 |
+
#### Using HTTPS
|
| 232 |
+
You can activate the validation of a secure SSL certificate to the target connection (avoid self-signed certs), just set `secure: true` in the options.
|
| 233 |
+
|
| 234 |
+
##### HTTPS -> HTTP
|
| 235 |
+
|
| 236 |
+
```js
|
| 237 |
+
//
|
| 238 |
+
// Create the HTTPS proxy server in front of a HTTP server
|
| 239 |
+
//
|
| 240 |
+
httpProxy.createServer({
|
| 241 |
+
target: {
|
| 242 |
+
host: 'localhost',
|
| 243 |
+
port: 9009
|
| 244 |
+
},
|
| 245 |
+
ssl: {
|
| 246 |
+
key: fs.readFileSync('valid-ssl-key.pem', 'utf8'),
|
| 247 |
+
cert: fs.readFileSync('valid-ssl-cert.pem', 'utf8')
|
| 248 |
+
}
|
| 249 |
+
}).listen(8009);
|
| 250 |
+
```
|
| 251 |
+
|
| 252 |
+
##### HTTPS -> HTTPS
|
| 253 |
+
|
| 254 |
+
```js
|
| 255 |
+
//
|
| 256 |
+
// Create the proxy server listening on port 443
|
| 257 |
+
//
|
| 258 |
+
httpProxy.createServer({
|
| 259 |
+
ssl: {
|
| 260 |
+
key: fs.readFileSync('valid-ssl-key.pem', 'utf8'),
|
| 261 |
+
cert: fs.readFileSync('valid-ssl-cert.pem', 'utf8')
|
| 262 |
+
},
|
| 263 |
+
target: 'https://localhost:9010',
|
| 264 |
+
secure: true // Depends on your needs, could be false.
|
| 265 |
+
}).listen(443);
|
| 266 |
+
```
|
| 267 |
+
|
| 268 |
+
##### HTTP -> HTTPS (using a PKCS12 client certificate)
|
| 269 |
+
|
| 270 |
+
```js
|
| 271 |
+
//
|
| 272 |
+
// Create an HTTP proxy server with an HTTPS target
|
| 273 |
+
//
|
| 274 |
+
httpProxy.createProxyServer({
|
| 275 |
+
target: {
|
| 276 |
+
protocol: 'https:',
|
| 277 |
+
host: 'my-domain-name',
|
| 278 |
+
port: 443,
|
| 279 |
+
pfx: fs.readFileSync('path/to/certificate.p12'),
|
| 280 |
+
passphrase: 'password',
|
| 281 |
+
},
|
| 282 |
+
changeOrigin: true,
|
| 283 |
+
}).listen(8000);
|
| 284 |
+
```
|
| 285 |
+
|
| 286 |
+
**[Back to top](#table-of-contents)**
|
| 287 |
+
|
| 288 |
+
#### Proxying WebSockets
|
| 289 |
+
You can activate the websocket support for the proxy using `ws:true` in the options.
|
| 290 |
+
|
| 291 |
+
```js
|
| 292 |
+
//
|
| 293 |
+
// Create a proxy server for websockets
|
| 294 |
+
//
|
| 295 |
+
httpProxy.createServer({
|
| 296 |
+
target: 'ws://localhost:9014',
|
| 297 |
+
ws: true
|
| 298 |
+
}).listen(8014);
|
| 299 |
+
```
|
| 300 |
+
|
| 301 |
+
Also you can proxy the websocket requests just calling the `ws(req, socket, head)` method.
|
| 302 |
+
|
| 303 |
+
```js
|
| 304 |
+
//
|
| 305 |
+
// Setup our server to proxy standard HTTP requests
|
| 306 |
+
//
|
| 307 |
+
var proxy = new httpProxy.createProxyServer({
|
| 308 |
+
target: {
|
| 309 |
+
host: 'localhost',
|
| 310 |
+
port: 9015
|
| 311 |
+
}
|
| 312 |
+
});
|
| 313 |
+
var proxyServer = http.createServer(function (req, res) {
|
| 314 |
+
proxy.web(req, res);
|
| 315 |
+
});
|
| 316 |
+
|
| 317 |
+
//
|
| 318 |
+
// Listen to the `upgrade` event and proxy the
|
| 319 |
+
// WebSocket requests as well.
|
| 320 |
+
//
|
| 321 |
+
proxyServer.on('upgrade', function (req, socket, head) {
|
| 322 |
+
proxy.ws(req, socket, head);
|
| 323 |
+
});
|
| 324 |
+
|
| 325 |
+
proxyServer.listen(8015);
|
| 326 |
+
```
|
| 327 |
+
|
| 328 |
+
**[Back to top](#table-of-contents)**
|
| 329 |
+
|
| 330 |
+
### Options
|
| 331 |
+
|
| 332 |
+
`httpProxy.createProxyServer` supports the following options:
|
| 333 |
+
|
| 334 |
+
* **target**: url string to be parsed with the url module
|
| 335 |
+
* **forward**: url string to be parsed with the url module
|
| 336 |
+
* **agent**: object to be passed to http(s).request (see Node's [https agent](http://nodejs.org/api/https.html#https_class_https_agent) and [http agent](http://nodejs.org/api/http.html#http_class_http_agent) objects)
|
| 337 |
+
* **ssl**: object to be passed to https.createServer()
|
| 338 |
+
* **ws**: true/false, if you want to proxy websockets
|
| 339 |
+
* **xfwd**: true/false, adds x-forward headers
|
| 340 |
+
* **secure**: true/false, if you want to verify the SSL Certs
|
| 341 |
+
* **toProxy**: true/false, passes the absolute URL as the `path` (useful for proxying to proxies)
|
| 342 |
+
* **prependPath**: true/false, Default: true - specify whether you want to prepend the target's path to the proxy path
|
| 343 |
+
* **ignorePath**: true/false, Default: false - specify whether you want to ignore the proxy path of the incoming request (note: you will have to append / manually if required).
|
| 344 |
+
* **localAddress**: Local interface string to bind for outgoing connections
|
| 345 |
+
* **changeOrigin**: true/false, Default: false - changes the origin of the host header to the target URL
|
| 346 |
+
* **preserveHeaderKeyCase**: true/false, Default: false - specify whether you want to keep letter case of response header key
|
| 347 |
+
* **auth**: Basic authentication i.e. 'user:password' to compute an Authorization header.
|
| 348 |
+
* **hostRewrite**: rewrites the location hostname on (201/301/302/307/308) redirects.
|
| 349 |
+
* **autoRewrite**: rewrites the location host/port on (201/301/302/307/308) redirects based on requested host/port. Default: false.
|
| 350 |
+
* **protocolRewrite**: rewrites the location protocol on (201/301/302/307/308) redirects to 'http' or 'https'. Default: null.
|
| 351 |
+
* **cookieDomainRewrite**: rewrites domain of `set-cookie` headers. Possible values:
|
| 352 |
+
* `false` (default): disable cookie rewriting
|
| 353 |
+
* String: new domain, for example `cookieDomainRewrite: "new.domain"`. To remove the domain, use `cookieDomainRewrite: ""`.
|
| 354 |
+
* Object: mapping of domains to new domains, use `"*"` to match all domains.
|
| 355 |
+
For example keep one domain unchanged, rewrite one domain and remove other domains:
|
| 356 |
+
```
|
| 357 |
+
cookieDomainRewrite: {
|
| 358 |
+
"unchanged.domain": "unchanged.domain",
|
| 359 |
+
"old.domain": "new.domain",
|
| 360 |
+
"*": ""
|
| 361 |
+
}
|
| 362 |
+
```
|
| 363 |
+
* **cookiePathRewrite**: rewrites path of `set-cookie` headers. Possible values:
|
| 364 |
+
* `false` (default): disable cookie rewriting
|
| 365 |
+
* String: new path, for example `cookiePathRewrite: "/newPath/"`. To remove the path, use `cookiePathRewrite: ""`. To set path to root use `cookiePathRewrite: "/"`.
|
| 366 |
+
* Object: mapping of paths to new paths, use `"*"` to match all paths.
|
| 367 |
+
For example, to keep one path unchanged, rewrite one path and remove other paths:
|
| 368 |
+
```
|
| 369 |
+
cookiePathRewrite: {
|
| 370 |
+
"/unchanged.path/": "/unchanged.path/",
|
| 371 |
+
"/old.path/": "/new.path/",
|
| 372 |
+
"*": ""
|
| 373 |
+
}
|
| 374 |
+
```
|
| 375 |
+
* **headers**: object with extra headers to be added to target requests.
|
| 376 |
+
* **proxyTimeout**: timeout (in millis) for outgoing proxy requests
|
| 377 |
+
* **timeout**: timeout (in millis) for incoming requests
|
| 378 |
+
* **followRedirects**: true/false, Default: false - specify whether you want to follow redirects
|
| 379 |
+
* **selfHandleResponse** true/false, if set to true, none of the webOutgoing passes are called and it's your responsibility to appropriately return the response by listening and acting on the `proxyRes` event
|
| 380 |
+
* **buffer**: stream of data to send as the request body. Maybe you have some middleware that consumes the request stream before proxying it on e.g. If you read the body of a request into a field called 'req.rawbody' you could restream this field in the buffer option:
|
| 381 |
+
|
| 382 |
+
```
|
| 383 |
+
'use strict';
|
| 384 |
+
|
| 385 |
+
const streamify = require('stream-array');
|
| 386 |
+
const HttpProxy = require('http-proxy');
|
| 387 |
+
const proxy = new HttpProxy();
|
| 388 |
+
|
| 389 |
+
module.exports = (req, res, next) => {
|
| 390 |
+
|
| 391 |
+
proxy.web(req, res, {
|
| 392 |
+
target: 'http://localhost:4003/',
|
| 393 |
+
buffer: streamify(req.rawBody)
|
| 394 |
+
}, next);
|
| 395 |
+
|
| 396 |
+
};
|
| 397 |
+
```
|
| 398 |
+
|
| 399 |
+
**NOTE:**
|
| 400 |
+
`options.ws` and `options.ssl` are optional.
|
| 401 |
+
`options.target` and `options.forward` cannot both be missing
|
| 402 |
+
|
| 403 |
+
If you are using the `proxyServer.listen` method, the following options are also applicable:
|
| 404 |
+
|
| 405 |
+
* **ssl**: object to be passed to https.createServer()
|
| 406 |
+
* **ws**: true/false, if you want to proxy websockets
|
| 407 |
+
|
| 408 |
+
|
| 409 |
+
**[Back to top](#table-of-contents)**
|
| 410 |
+
|
| 411 |
+
### Listening for proxy events
|
| 412 |
+
|
| 413 |
+
* `error`: The error event is emitted if the request to the target fail. **We do not do any error handling of messages passed between client and proxy, and messages passed between proxy and target, so it is recommended that you listen on errors and handle them.**
|
| 414 |
+
* `proxyReq`: This event is emitted before the data is sent. It gives you a chance to alter the proxyReq request object. Applies to "web" connections
|
| 415 |
+
* `proxyReqWs`: This event is emitted before the data is sent. It gives you a chance to alter the proxyReq request object. Applies to "websocket" connections
|
| 416 |
+
* `proxyRes`: This event is emitted if the request to the target got a response.
|
| 417 |
+
* `open`: This event is emitted once the proxy websocket was created and piped into the target websocket.
|
| 418 |
+
* `close`: This event is emitted once the proxy websocket was closed.
|
| 419 |
+
* (DEPRECATED) `proxySocket`: Deprecated in favor of `open`.
|
| 420 |
+
|
| 421 |
+
```js
|
| 422 |
+
var httpProxy = require('http-proxy');
|
| 423 |
+
// Error example
|
| 424 |
+
//
|
| 425 |
+
// Http Proxy Server with bad target
|
| 426 |
+
//
|
| 427 |
+
var proxy = httpProxy.createServer({
|
| 428 |
+
target:'http://localhost:9005'
|
| 429 |
+
});
|
| 430 |
+
|
| 431 |
+
proxy.listen(8005);
|
| 432 |
+
|
| 433 |
+
//
|
| 434 |
+
// Listen for the `error` event on `proxy`.
|
| 435 |
+
proxy.on('error', function (err, req, res) {
|
| 436 |
+
res.writeHead(500, {
|
| 437 |
+
'Content-Type': 'text/plain'
|
| 438 |
+
});
|
| 439 |
+
|
| 440 |
+
res.end('Something went wrong. And we are reporting a custom error message.');
|
| 441 |
+
});
|
| 442 |
+
|
| 443 |
+
//
|
| 444 |
+
// Listen for the `proxyRes` event on `proxy`.
|
| 445 |
+
//
|
| 446 |
+
proxy.on('proxyRes', function (proxyRes, req, res) {
|
| 447 |
+
console.log('RAW Response from the target', JSON.stringify(proxyRes.headers, true, 2));
|
| 448 |
+
});
|
| 449 |
+
|
| 450 |
+
//
|
| 451 |
+
// Listen for the `open` event on `proxy`.
|
| 452 |
+
//
|
| 453 |
+
proxy.on('open', function (proxySocket) {
|
| 454 |
+
// listen for messages coming FROM the target here
|
| 455 |
+
proxySocket.on('data', hybiParseAndLogMessage);
|
| 456 |
+
});
|
| 457 |
+
|
| 458 |
+
//
|
| 459 |
+
// Listen for the `close` event on `proxy`.
|
| 460 |
+
//
|
| 461 |
+
proxy.on('close', function (res, socket, head) {
|
| 462 |
+
// view disconnected websocket connections
|
| 463 |
+
console.log('Client disconnected');
|
| 464 |
+
});
|
| 465 |
+
```
|
| 466 |
+
|
| 467 |
+
**[Back to top](#table-of-contents)**
|
| 468 |
+
|
| 469 |
+
### Shutdown
|
| 470 |
+
|
| 471 |
+
* When testing or running server within another program it may be necessary to close the proxy.
|
| 472 |
+
* This will stop the proxy from accepting new connections.
|
| 473 |
+
|
| 474 |
+
```js
|
| 475 |
+
var proxy = new httpProxy.createProxyServer({
|
| 476 |
+
target: {
|
| 477 |
+
host: 'localhost',
|
| 478 |
+
port: 1337
|
| 479 |
+
}
|
| 480 |
+
});
|
| 481 |
+
|
| 482 |
+
proxy.close();
|
| 483 |
+
```
|
| 484 |
+
|
| 485 |
+
**[Back to top](#table-of-contents)**
|
| 486 |
+
|
| 487 |
+
### Miscellaneous
|
| 488 |
+
|
| 489 |
+
If you want to handle your own response after receiving the `proxyRes`, you can do
|
| 490 |
+
so with `selfHandleResponse`. As you can see below, if you use this option, you
|
| 491 |
+
are able to intercept and read the `proxyRes` but you must also make sure to
|
| 492 |
+
reply to the `res` itself otherwise the original client will never receive any
|
| 493 |
+
data.
|
| 494 |
+
|
| 495 |
+
### Modify response
|
| 496 |
+
|
| 497 |
+
```js
|
| 498 |
+
|
| 499 |
+
var option = {
|
| 500 |
+
target: target,
|
| 501 |
+
selfHandleResponse : true
|
| 502 |
+
};
|
| 503 |
+
proxy.on('proxyRes', function (proxyRes, req, res) {
|
| 504 |
+
var body = [];
|
| 505 |
+
proxyRes.on('data', function (chunk) {
|
| 506 |
+
body.push(chunk);
|
| 507 |
+
});
|
| 508 |
+
proxyRes.on('end', function () {
|
| 509 |
+
body = Buffer.concat(body).toString();
|
| 510 |
+
console.log("res from proxied server:", body);
|
| 511 |
+
res.end("my response to cli");
|
| 512 |
+
});
|
| 513 |
+
});
|
| 514 |
+
proxy.web(req, res, option);
|
| 515 |
+
|
| 516 |
+
|
| 517 |
+
```
|
| 518 |
+
|
| 519 |
+
#### ProxyTable API
|
| 520 |
+
|
| 521 |
+
A proxy table API is available through this add-on [module](https://github.com/donasaur/http-proxy-rules), which lets you define a set of rules to translate matching routes to target routes that the reverse proxy will talk to.
|
| 522 |
+
|
| 523 |
+
#### Test
|
| 524 |
+
|
| 525 |
+
```
|
| 526 |
+
$ npm test
|
| 527 |
+
```
|
| 528 |
+
|
| 529 |
+
#### Logo
|
| 530 |
+
|
| 531 |
+
Logo created by [Diego Pasquali](http://dribbble.com/diegopq)
|
| 532 |
+
|
| 533 |
+
**[Back to top](#table-of-contents)**
|
| 534 |
+
|
| 535 |
+
### Contributing and Issues
|
| 536 |
+
|
| 537 |
+
* Read carefully our [Code Of Conduct](https://github.com/http-party/node-http-proxy/blob/master/CODE_OF_CONDUCT.md)
|
| 538 |
+
* Search on Google/Github
|
| 539 |
+
* If you can't find anything, open an issue
|
| 540 |
+
* If you feel comfortable about fixing the issue, fork the repo
|
| 541 |
+
* Commit to your local branch (which must be different from `master`)
|
| 542 |
+
* Submit your Pull Request (be sure to include tests and update documentation)
|
| 543 |
+
|
| 544 |
+
**[Back to top](#table-of-contents)**
|
| 545 |
+
|
| 546 |
+
### License
|
| 547 |
+
|
| 548 |
+
>The MIT License (MIT)
|
| 549 |
+
>
|
| 550 |
+
>Copyright (c) 2010 - 2016 Charlie Robbins, Jarrett Cruger & the Contributors.
|
| 551 |
+
>
|
| 552 |
+
>Permission is hereby granted, free of charge, to any person obtaining a copy
|
| 553 |
+
>of this software and associated documentation files (the "Software"), to deal
|
| 554 |
+
>in the Software without restriction, including without limitation the rights
|
| 555 |
+
>to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
| 556 |
+
>copies of the Software, and to permit persons to whom the Software is
|
| 557 |
+
>furnished to do so, subject to the following conditions:
|
| 558 |
+
>
|
| 559 |
+
>The above copyright notice and this permission notice shall be included in
|
| 560 |
+
>all copies or substantial portions of the Software.
|
| 561 |
+
>
|
| 562 |
+
>THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
| 563 |
+
>IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
| 564 |
+
>FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
| 565 |
+
>AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
| 566 |
+
>LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
| 567 |
+
>OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
| 568 |
+
>THE SOFTWARE.
|
`/Agents/influencer-thread-pipeline/.venv/Lib/site-packages/gradio/templates/node/build/node_modules/http-proxy/codecov.yml
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
coverage:
|
| 2 |
+
parsers:
|
| 3 |
+
javascript:
|
| 4 |
+
enable_partials: yes
|
| 5 |
+
status:
|
| 6 |
+
project:
|
| 7 |
+
default:
|
| 8 |
+
target: "70%"
|
| 9 |
+
patch:
|
| 10 |
+
enabled: false
|
`/Agents/influencer-thread-pipeline/.venv/Lib/site-packages/gradio/templates/node/build/node_modules/http-proxy/index.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/*!
|
| 2 |
+
* Caron dimonio, con occhi di bragia
|
| 3 |
+
* loro accennando, tutte le raccoglie;
|
| 4 |
+
* batte col remo qualunque s’adagia
|
| 5 |
+
*
|
| 6 |
+
* Charon the demon, with the eyes of glede,
|
| 7 |
+
* Beckoning to them, collects them all together,
|
| 8 |
+
* Beats with his oar whoever lags behind
|
| 9 |
+
*
|
| 10 |
+
* Dante - The Divine Comedy (Canto III)
|
| 11 |
+
*/
|
| 12 |
+
|
| 13 |
+
module.exports = require('./lib/http-proxy');
|
`/Agents/influencer-thread-pipeline/.venv/Lib/site-packages/gradio/templates/node/build/node_modules/http-proxy/lib/http-proxy.js
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// Use explicit /index.js to help browserify negociation in require '/lib/http-proxy' (!)
|
| 2 |
+
var ProxyServer = require('./http-proxy/index.js').Server;
|
| 3 |
+
|
| 4 |
+
|
| 5 |
+
/**
|
| 6 |
+
* Creates the proxy server.
|
| 7 |
+
*
|
| 8 |
+
* Examples:
|
| 9 |
+
*
|
| 10 |
+
* httpProxy.createProxyServer({ .. }, 8000)
|
| 11 |
+
* // => '{ web: [Function], ws: [Function] ... }'
|
| 12 |
+
*
|
| 13 |
+
* @param {Object} Options Config object passed to the proxy
|
| 14 |
+
*
|
| 15 |
+
* @return {Object} Proxy Proxy object with handlers for `ws` and `web` requests
|
| 16 |
+
*
|
| 17 |
+
* @api public
|
| 18 |
+
*/
|
| 19 |
+
|
| 20 |
+
|
| 21 |
+
function createProxyServer(options) {
|
| 22 |
+
/*
|
| 23 |
+
* `options` is needed and it must have the following layout:
|
| 24 |
+
*
|
| 25 |
+
* {
|
| 26 |
+
* target : <url string to be parsed with the url module>
|
| 27 |
+
* forward: <url string to be parsed with the url module>
|
| 28 |
+
* agent : <object to be passed to http(s).request>
|
| 29 |
+
* ssl : <object to be passed to https.createServer()>
|
| 30 |
+
* ws : <true/false, if you want to proxy websockets>
|
| 31 |
+
* xfwd : <true/false, adds x-forward headers>
|
| 32 |
+
* secure : <true/false, verify SSL certificate>
|
| 33 |
+
* toProxy: <true/false, explicitly specify if we are proxying to another proxy>
|
| 34 |
+
* prependPath: <true/false, Default: true - specify whether you want to prepend the target's path to the proxy path>
|
| 35 |
+
* ignorePath: <true/false, Default: false - specify whether you want to ignore the proxy path of the incoming request>
|
| 36 |
+
* localAddress : <Local interface string to bind for outgoing connections>
|
| 37 |
+
* changeOrigin: <true/false, Default: false - changes the origin of the host header to the target URL>
|
| 38 |
+
* preserveHeaderKeyCase: <true/false, Default: false - specify whether you want to keep letter case of response header key >
|
| 39 |
+
* auth : Basic authentication i.e. 'user:password' to compute an Authorization header.
|
| 40 |
+
* hostRewrite: rewrites the location hostname on (201/301/302/307/308) redirects, Default: null.
|
| 41 |
+
* autoRewrite: rewrites the location host/port on (201/301/302/307/308) redirects based on requested host/port. Default: false.
|
| 42 |
+
* protocolRewrite: rewrites the location protocol on (201/301/302/307/308) redirects to 'http' or 'https'. Default: null.
|
| 43 |
+
* }
|
| 44 |
+
*
|
| 45 |
+
* NOTE: `options.ws` and `options.ssl` are optional.
|
| 46 |
+
* `options.target and `options.forward` cannot be
|
| 47 |
+
* both missing
|
| 48 |
+
* }
|
| 49 |
+
*/
|
| 50 |
+
|
| 51 |
+
return new ProxyServer(options);
|
| 52 |
+
}
|
| 53 |
+
|
| 54 |
+
|
| 55 |
+
ProxyServer.createProxyServer = createProxyServer;
|
| 56 |
+
ProxyServer.createServer = createProxyServer;
|
| 57 |
+
ProxyServer.createProxy = createProxyServer;
|
| 58 |
+
|
| 59 |
+
|
| 60 |
+
|
| 61 |
+
|
| 62 |
+
/**
|
| 63 |
+
* Export the proxy "Server" as the main export.
|
| 64 |
+
*/
|
| 65 |
+
module.exports = ProxyServer;
|
| 66 |
+
|
`/Agents/influencer-thread-pipeline/.venv/Lib/site-packages/gradio/templates/node/build/node_modules/http-proxy/lib/http-proxy/common.js
ADDED
|
@@ -0,0 +1,248 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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port');
|
| 5 |
+
|
| 6 |
+
var upgradeHeader = /(^|,)\s*upgrade\s*($|,)/i,
|
| 7 |
+
isSSL = /^https|wss/;
|
| 8 |
+
|
| 9 |
+
/**
|
| 10 |
+
* Simple Regex for testing if protocol is https
|
| 11 |
+
*/
|
| 12 |
+
common.isSSL = isSSL;
|
| 13 |
+
/**
|
| 14 |
+
* Copies the right headers from `options` and `req` to
|
| 15 |
+
* `outgoing` which is then used to fire the proxied
|
| 16 |
+
* request.
|
| 17 |
+
*
|
| 18 |
+
* Examples:
|
| 19 |
+
*
|
| 20 |
+
* common.setupOutgoing(outgoing, options, req)
|
| 21 |
+
* // => { host: ..., hostname: ...}
|
| 22 |
+
*
|
| 23 |
+
* @param {Object} Outgoing Base object to be filled with required properties
|
| 24 |
+
* @param {Object} Options Config object passed to the proxy
|
| 25 |
+
* @param {ClientRequest} Req Request Object
|
| 26 |
+
* @param {String} Forward String to select forward or target
|
| 27 |
+
*
|
| 28 |
+
* @return {Object} Outgoing Object with all required properties set
|
| 29 |
+
*
|
| 30 |
+
* @api private
|
| 31 |
+
*/
|
| 32 |
+
|
| 33 |
+
common.setupOutgoing = function(outgoing, options, req, forward) {
|
| 34 |
+
outgoing.port = options[forward || 'target'].port ||
|
| 35 |
+
(isSSL.test(options[forward || 'target'].protocol) ? 443 : 80);
|
| 36 |
+
|
| 37 |
+
['host', 'hostname', 'socketPath', 'pfx', 'key',
|
| 38 |
+
'passphrase', 'cert', 'ca', 'ciphers', 'secureProtocol'].forEach(
|
| 39 |
+
function(e) { outgoing[e] = options[forward || 'target'][e]; }
|
| 40 |
+
);
|
| 41 |
+
|
| 42 |
+
outgoing.method = options.method || req.method;
|
| 43 |
+
outgoing.headers = extend({}, req.headers);
|
| 44 |
+
|
| 45 |
+
if (options.headers){
|
| 46 |
+
extend(outgoing.headers, options.headers);
|
| 47 |
+
}
|
| 48 |
+
|
| 49 |
+
if (options.auth) {
|
| 50 |
+
outgoing.auth = options.auth;
|
| 51 |
+
}
|
| 52 |
+
|
| 53 |
+
if (options.ca) {
|
| 54 |
+
outgoing.ca = options.ca;
|
| 55 |
+
}
|
| 56 |
+
|
| 57 |
+
if (isSSL.test(options[forward || 'target'].protocol)) {
|
| 58 |
+
outgoing.rejectUnauthorized = (typeof options.secure === "undefined") ? true : options.secure;
|
| 59 |
+
}
|
| 60 |
+
|
| 61 |
+
|
| 62 |
+
outgoing.agent = options.agent || false;
|
| 63 |
+
outgoing.localAddress = options.localAddress;
|
| 64 |
+
|
| 65 |
+
//
|
| 66 |
+
// Remark: If we are false and not upgrading, set the connection: close. This is the right thing to do
|
| 67 |
+
// as node core doesn't handle this COMPLETELY properly yet.
|
| 68 |
+
//
|
| 69 |
+
if (!outgoing.agent) {
|
| 70 |
+
outgoing.headers = outgoing.headers || {};
|
| 71 |
+
if (typeof outgoing.headers.connection !== 'string'
|
| 72 |
+
|| !upgradeHeader.test(outgoing.headers.connection)
|
| 73 |
+
) { outgoing.headers.connection = 'close'; }
|
| 74 |
+
}
|
| 75 |
+
|
| 76 |
+
|
| 77 |
+
// the final path is target path + relative path requested by user:
|
| 78 |
+
var target = options[forward || 'target'];
|
| 79 |
+
var targetPath = target && options.prependPath !== false
|
| 80 |
+
? (target.path || '')
|
| 81 |
+
: '';
|
| 82 |
+
|
| 83 |
+
//
|
| 84 |
+
// Remark: Can we somehow not use url.parse as a perf optimization?
|
| 85 |
+
//
|
| 86 |
+
var outgoingPath = !options.toProxy
|
| 87 |
+
? (url.parse(req.url).path || '')
|
| 88 |
+
: req.url;
|
| 89 |
+
|
| 90 |
+
//
|
| 91 |
+
// Remark: ignorePath will just straight up ignore whatever the request's
|
| 92 |
+
// path is. This can be labeled as FOOT-GUN material if you do not know what
|
| 93 |
+
// you are doing and are using conflicting options.
|
| 94 |
+
//
|
| 95 |
+
outgoingPath = !options.ignorePath ? outgoingPath : '';
|
| 96 |
+
|
| 97 |
+
outgoing.path = common.urlJoin(targetPath, outgoingPath);
|
| 98 |
+
|
| 99 |
+
if (options.changeOrigin) {
|
| 100 |
+
outgoing.headers.host =
|
| 101 |
+
required(outgoing.port, options[forward || 'target'].protocol) && !hasPort(outgoing.host)
|
| 102 |
+
? outgoing.host + ':' + outgoing.port
|
| 103 |
+
: outgoing.host;
|
| 104 |
+
}
|
| 105 |
+
return outgoing;
|
| 106 |
+
};
|
| 107 |
+
|
| 108 |
+
/**
|
| 109 |
+
* Set the proper configuration for sockets,
|
| 110 |
+
* set no delay and set keep alive, also set
|
| 111 |
+
* the timeout to 0.
|
| 112 |
+
*
|
| 113 |
+
* Examples:
|
| 114 |
+
*
|
| 115 |
+
* common.setupSocket(socket)
|
| 116 |
+
* // => Socket
|
| 117 |
+
*
|
| 118 |
+
* @param {Socket} Socket instance to setup
|
| 119 |
+
*
|
| 120 |
+
* @return {Socket} Return the configured socket.
|
| 121 |
+
*
|
| 122 |
+
* @api private
|
| 123 |
+
*/
|
| 124 |
+
|
| 125 |
+
common.setupSocket = function(socket) {
|
| 126 |
+
socket.setTimeout(0);
|
| 127 |
+
socket.setNoDelay(true);
|
| 128 |
+
|
| 129 |
+
socket.setKeepAlive(true, 0);
|
| 130 |
+
|
| 131 |
+
return socket;
|
| 132 |
+
};
|
| 133 |
+
|
| 134 |
+
/**
|
| 135 |
+
* Get the port number from the host. Or guess it based on the connection type.
|
| 136 |
+
*
|
| 137 |
+
* @param {Request} req Incoming HTTP request.
|
| 138 |
+
*
|
| 139 |
+
* @return {String} The port number.
|
| 140 |
+
*
|
| 141 |
+
* @api private
|
| 142 |
+
*/
|
| 143 |
+
common.getPort = function(req) {
|
| 144 |
+
var res = req.headers.host ? req.headers.host.match(/:(\d+)/) : '';
|
| 145 |
+
|
| 146 |
+
return res ?
|
| 147 |
+
res[1] :
|
| 148 |
+
common.hasEncryptedConnection(req) ? '443' : '80';
|
| 149 |
+
};
|
| 150 |
+
|
| 151 |
+
/**
|
| 152 |
+
* Check if the request has an encrypted connection.
|
| 153 |
+
*
|
| 154 |
+
* @param {Request} req Incoming HTTP request.
|
| 155 |
+
*
|
| 156 |
+
* @return {Boolean} Whether the connection is encrypted or not.
|
| 157 |
+
*
|
| 158 |
+
* @api private
|
| 159 |
+
*/
|
| 160 |
+
common.hasEncryptedConnection = function(req) {
|
| 161 |
+
return Boolean(req.connection.encrypted || req.connection.pair);
|
| 162 |
+
};
|
| 163 |
+
|
| 164 |
+
/**
|
| 165 |
+
* OS-agnostic join (doesn't break on URLs like path.join does on Windows)>
|
| 166 |
+
*
|
| 167 |
+
* @return {String} The generated path.
|
| 168 |
+
*
|
| 169 |
+
* @api private
|
| 170 |
+
*/
|
| 171 |
+
|
| 172 |
+
common.urlJoin = function() {
|
| 173 |
+
//
|
| 174 |
+
// We do not want to mess with the query string. All we want to touch is the path.
|
| 175 |
+
//
|
| 176 |
+
var args = Array.prototype.slice.call(arguments),
|
| 177 |
+
lastIndex = args.length - 1,
|
| 178 |
+
last = args[lastIndex],
|
| 179 |
+
lastSegs = last.split('?'),
|
| 180 |
+
retSegs;
|
| 181 |
+
|
| 182 |
+
args[lastIndex] = lastSegs.shift();
|
| 183 |
+
|
| 184 |
+
//
|
| 185 |
+
// Join all strings, but remove empty strings so we don't get extra slashes from
|
| 186 |
+
// joining e.g. ['', 'am']
|
| 187 |
+
//
|
| 188 |
+
retSegs = [
|
| 189 |
+
args.filter(Boolean).join('/')
|
| 190 |
+
.replace(/\/+/g, '/')
|
| 191 |
+
.replace('http:/', 'http://')
|
| 192 |
+
.replace('https:/', 'https://')
|
| 193 |
+
];
|
| 194 |
+
|
| 195 |
+
// Only join the query string if it exists so we don't have trailing a '?'
|
| 196 |
+
// on every request
|
| 197 |
+
|
| 198 |
+
// Handle case where there could be multiple ? in the URL.
|
| 199 |
+
retSegs.push.apply(retSegs, lastSegs);
|
| 200 |
+
|
| 201 |
+
return retSegs.join('?')
|
| 202 |
+
};
|
| 203 |
+
|
| 204 |
+
/**
|
| 205 |
+
* Rewrites or removes the domain of a cookie header
|
| 206 |
+
*
|
| 207 |
+
* @param {String|Array} Header
|
| 208 |
+
* @param {Object} Config, mapping of domain to rewritten domain.
|
| 209 |
+
* '*' key to match any domain, null value to remove the domain.
|
| 210 |
+
*
|
| 211 |
+
* @api private
|
| 212 |
+
*/
|
| 213 |
+
common.rewriteCookieProperty = function rewriteCookieProperty(header, config, property) {
|
| 214 |
+
if (Array.isArray(header)) {
|
| 215 |
+
return header.map(function (headerElement) {
|
| 216 |
+
return rewriteCookieProperty(headerElement, config, property);
|
| 217 |
+
});
|
| 218 |
+
}
|
| 219 |
+
return header.replace(new RegExp("(;\\s*" + property + "=)([^;]+)", 'i'), function(match, prefix, previousValue) {
|
| 220 |
+
var newValue;
|
| 221 |
+
if (previousValue in config) {
|
| 222 |
+
newValue = config[previousValue];
|
| 223 |
+
} else if ('*' in config) {
|
| 224 |
+
newValue = config['*'];
|
| 225 |
+
} else {
|
| 226 |
+
//no match, return previous value
|
| 227 |
+
return match;
|
| 228 |
+
}
|
| 229 |
+
if (newValue) {
|
| 230 |
+
//replace value
|
| 231 |
+
return prefix + newValue;
|
| 232 |
+
} else {
|
| 233 |
+
//remove value
|
| 234 |
+
return '';
|
| 235 |
+
}
|
| 236 |
+
});
|
| 237 |
+
};
|
| 238 |
+
|
| 239 |
+
/**
|
| 240 |
+
* Check the host and see if it potentially has a port in it (keep it simple)
|
| 241 |
+
*
|
| 242 |
+
* @returns {Boolean} Whether we have one or not
|
| 243 |
+
*
|
| 244 |
+
* @api private
|
| 245 |
+
*/
|
| 246 |
+
function hasPort(host) {
|
| 247 |
+
return !!~host.indexOf(':');
|
| 248 |
+
};
|
`/Agents/influencer-thread-pipeline/.venv/Lib/site-packages/gradio/templates/node/build/node_modules/http-proxy/lib/http-proxy/index.js
ADDED
|
@@ -0,0 +1,185 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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end = require('util')._extend,
|
| 3 |
+
parse_url = require('url').parse,
|
| 4 |
+
EE3 = require('eventemitter3'),
|
| 5 |
+
http = require('http'),
|
| 6 |
+
https = require('https'),
|
| 7 |
+
web = require('./passes/web-incoming'),
|
| 8 |
+
ws = require('./passes/ws-incoming');
|
| 9 |
+
|
| 10 |
+
httpProxy.Server = ProxyServer;
|
| 11 |
+
|
| 12 |
+
/**
|
| 13 |
+
* Returns a function that creates the loader for
|
| 14 |
+
* either `ws` or `web`'s passes.
|
| 15 |
+
*
|
| 16 |
+
* Examples:
|
| 17 |
+
*
|
| 18 |
+
* httpProxy.createRightProxy('ws')
|
| 19 |
+
* // => [Function]
|
| 20 |
+
*
|
| 21 |
+
* @param {String} Type Either 'ws' or 'web'
|
| 22 |
+
*
|
| 23 |
+
* @return {Function} Loader Function that when called returns an iterator for the right passes
|
| 24 |
+
*
|
| 25 |
+
* @api private
|
| 26 |
+
*/
|
| 27 |
+
|
| 28 |
+
function createRightProxy(type) {
|
| 29 |
+
|
| 30 |
+
return function(options) {
|
| 31 |
+
return function(req, res /*, [head], [opts] */) {
|
| 32 |
+
var passes = (type === 'ws') ? this.wsPasses : this.webPasses,
|
| 33 |
+
args = [].slice.call(arguments),
|
| 34 |
+
cntr = args.length - 1,
|
| 35 |
+
head, cbl;
|
| 36 |
+
|
| 37 |
+
/* optional args parse begin */
|
| 38 |
+
if(typeof args[cntr] === 'function') {
|
| 39 |
+
cbl = args[cntr];
|
| 40 |
+
|
| 41 |
+
cntr--;
|
| 42 |
+
}
|
| 43 |
+
|
| 44 |
+
var requestOptions = options;
|
| 45 |
+
if(
|
| 46 |
+
!(args[cntr] instanceof Buffer) &&
|
| 47 |
+
args[cntr] !== res
|
| 48 |
+
) {
|
| 49 |
+
//Copy global options
|
| 50 |
+
requestOptions = extend({}, options);
|
| 51 |
+
//Overwrite with request options
|
| 52 |
+
extend(requestOptions, args[cntr]);
|
| 53 |
+
|
| 54 |
+
cntr--;
|
| 55 |
+
}
|
| 56 |
+
|
| 57 |
+
if(args[cntr] instanceof Buffer) {
|
| 58 |
+
head = args[cntr];
|
| 59 |
+
}
|
| 60 |
+
|
| 61 |
+
/* optional args parse end */
|
| 62 |
+
|
| 63 |
+
['target', 'forward'].forEach(function(e) {
|
| 64 |
+
if (typeof requestOptions[e] === 'string')
|
| 65 |
+
requestOptions[e] = parse_url(requestOptions[e]);
|
| 66 |
+
});
|
| 67 |
+
|
| 68 |
+
if (!requestOptions.target && !requestOptions.forward) {
|
| 69 |
+
return this.emit('error', new Error('Must provide a proper URL as target'));
|
| 70 |
+
}
|
| 71 |
+
|
| 72 |
+
for(var i=0; i < passes.length; i++) {
|
| 73 |
+
/**
|
| 74 |
+
* Call of passes functions
|
| 75 |
+
* pass(req, res, options, head)
|
| 76 |
+
*
|
| 77 |
+
* In WebSockets case the `res` variable
|
| 78 |
+
* refer to the connection socket
|
| 79 |
+
* pass(req, socket, options, head)
|
| 80 |
+
*/
|
| 81 |
+
if(passes[i](req, res, requestOptions, head, this, cbl)) { // passes can return a truthy value to halt the loop
|
| 82 |
+
break;
|
| 83 |
+
}
|
| 84 |
+
}
|
| 85 |
+
};
|
| 86 |
+
};
|
| 87 |
+
}
|
| 88 |
+
httpProxy.createRightProxy = createRightProxy;
|
| 89 |
+
|
| 90 |
+
function ProxyServer(options) {
|
| 91 |
+
EE3.call(this);
|
| 92 |
+
|
| 93 |
+
options = options || {};
|
| 94 |
+
options.prependPath = options.prependPath === false ? false : true;
|
| 95 |
+
|
| 96 |
+
this.web = this.proxyRequest = createRightProxy('web')(options);
|
| 97 |
+
this.ws = this.proxyWebsocketRequest = createRightProxy('ws')(options);
|
| 98 |
+
this.options = options;
|
| 99 |
+
|
| 100 |
+
this.webPasses = Object.keys(web).map(function(pass) {
|
| 101 |
+
return web[pass];
|
| 102 |
+
});
|
| 103 |
+
|
| 104 |
+
this.wsPasses = Object.keys(ws).map(function(pass) {
|
| 105 |
+
return ws[pass];
|
| 106 |
+
});
|
| 107 |
+
|
| 108 |
+
this.on('error', this.onError, this);
|
| 109 |
+
|
| 110 |
+
}
|
| 111 |
+
|
| 112 |
+
require('util').inherits(ProxyServer, EE3);
|
| 113 |
+
|
| 114 |
+
ProxyServer.prototype.onError = function (err) {
|
| 115 |
+
//
|
| 116 |
+
// Remark: Replicate node core behavior using EE3
|
| 117 |
+
// so we force people to handle their own errors
|
| 118 |
+
//
|
| 119 |
+
if(this.listeners('error').length === 1) {
|
| 120 |
+
throw err;
|
| 121 |
+
}
|
| 122 |
+
};
|
| 123 |
+
|
| 124 |
+
ProxyServer.prototype.listen = function(port, hostname) {
|
| 125 |
+
var self = this,
|
| 126 |
+
closure = function(req, res) { self.web(req, res); };
|
| 127 |
+
|
| 128 |
+
this._server = this.options.ssl ?
|
| 129 |
+
https.createServer(this.options.ssl, closure) :
|
| 130 |
+
http.createServer(closure);
|
| 131 |
+
|
| 132 |
+
if(this.options.ws) {
|
| 133 |
+
this._server.on('upgrade', function(req, socket, head) { self.ws(req, socket, head); });
|
| 134 |
+
}
|
| 135 |
+
|
| 136 |
+
this._server.listen(port, hostname);
|
| 137 |
+
|
| 138 |
+
return this;
|
| 139 |
+
};
|
| 140 |
+
|
| 141 |
+
ProxyServer.prototype.close = function(callback) {
|
| 142 |
+
var self = this;
|
| 143 |
+
if (this._server) {
|
| 144 |
+
this._server.close(done);
|
| 145 |
+
}
|
| 146 |
+
|
| 147 |
+
// Wrap callback to nullify server after all open connections are closed.
|
| 148 |
+
function done() {
|
| 149 |
+
self._server = null;
|
| 150 |
+
if (callback) {
|
| 151 |
+
callback.apply(null, arguments);
|
| 152 |
+
}
|
| 153 |
+
};
|
| 154 |
+
};
|
| 155 |
+
|
| 156 |
+
ProxyServer.prototype.before = function(type, passName, callback) {
|
| 157 |
+
if (type !== 'ws' && type !== 'web') {
|
| 158 |
+
throw new Error('type must be `web` or `ws`');
|
| 159 |
+
}
|
| 160 |
+
var passes = (type === 'ws') ? this.wsPasses : this.webPasses,
|
| 161 |
+
i = false;
|
| 162 |
+
|
| 163 |
+
passes.forEach(function(v, idx) {
|
| 164 |
+
if(v.name === passName) i = idx;
|
| 165 |
+
})
|
| 166 |
+
|
| 167 |
+
if(i === false) throw new Error('No such pass');
|
| 168 |
+
|
| 169 |
+
passes.splice(i, 0, callback);
|
| 170 |
+
};
|
| 171 |
+
ProxyServer.prototype.after = function(type, passName, callback) {
|
| 172 |
+
if (type !== 'ws' && type !== 'web') {
|
| 173 |
+
throw new Error('type must be `web` or `ws`');
|
| 174 |
+
}
|
| 175 |
+
var passes = (type === 'ws') ? this.wsPasses : this.webPasses,
|
| 176 |
+
i = false;
|
| 177 |
+
|
| 178 |
+
passes.forEach(function(v, idx) {
|
| 179 |
+
if(v.name === passName) i = idx;
|
| 180 |
+
})
|
| 181 |
+
|
| 182 |
+
if(i === false) throw new Error('No such pass');
|
| 183 |
+
|
| 184 |
+
passes.splice(i++, 0, callback);
|
| 185 |
+
};
|
`/Agents/influencer-thread-pipeline/.venv/Lib/site-packages/gradio/templates/node/build/node_modules/http-proxy/lib/http-proxy/passes/web-incoming.js
ADDED
|
@@ -0,0 +1,194 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
var httpNative = require('http'),
|
| 2 |
+
httpsNative = require('https'),
|
| 3 |
+
web_o = require('./web-outgoing'),
|
| 4 |
+
common = require('../common'),
|
| 5 |
+
followRedirects = require('follow-redirects');
|
| 6 |
+
|
| 7 |
+
web_o = Object.keys(web_o).map(function(pass) {
|
| 8 |
+
return web_o[pass];
|
| 9 |
+
});
|
| 10 |
+
|
| 11 |
+
var nativeAgents = { http: httpNative, https: httpsNative };
|
| 12 |
+
|
| 13 |
+
/*!
|
| 14 |
+
* Array of passes.
|
| 15 |
+
*
|
| 16 |
+
* A `pass` is just a function that is executed on `req, res, options`
|
| 17 |
+
* so that you can easily add new checks while still keeping the base
|
| 18 |
+
* flexible.
|
| 19 |
+
*/
|
| 20 |
+
|
| 21 |
+
|
| 22 |
+
module.exports = {
|
| 23 |
+
|
| 24 |
+
/**
|
| 25 |
+
* Sets `content-length` to '0' if request is of DELETE type.
|
| 26 |
+
*
|
| 27 |
+
* @param {ClientRequest} Req Request object
|
| 28 |
+
* @param {IncomingMessage} Res Response object
|
| 29 |
+
* @param {Object} Options Config object passed to the proxy
|
| 30 |
+
*
|
| 31 |
+
* @api private
|
| 32 |
+
*/
|
| 33 |
+
|
| 34 |
+
deleteLength: function deleteLength(req, res, options) {
|
| 35 |
+
if((req.method === 'DELETE' || req.method === 'OPTIONS')
|
| 36 |
+
&& !req.headers['content-length']) {
|
| 37 |
+
req.headers['content-length'] = '0';
|
| 38 |
+
delete req.headers['transfer-encoding'];
|
| 39 |
+
}
|
| 40 |
+
},
|
| 41 |
+
|
| 42 |
+
/**
|
| 43 |
+
* Sets timeout in request socket if it was specified in options.
|
| 44 |
+
*
|
| 45 |
+
* @param {ClientRequest} Req Request object
|
| 46 |
+
* @param {IncomingMessage} Res Response object
|
| 47 |
+
* @param {Object} Options Config object passed to the proxy
|
| 48 |
+
*
|
| 49 |
+
* @api private
|
| 50 |
+
*/
|
| 51 |
+
|
| 52 |
+
timeout: function timeout(req, res, options) {
|
| 53 |
+
if(options.timeout) {
|
| 54 |
+
req.socket.setTimeout(options.timeout);
|
| 55 |
+
}
|
| 56 |
+
},
|
| 57 |
+
|
| 58 |
+
/**
|
| 59 |
+
* Sets `x-forwarded-*` headers if specified in config.
|
| 60 |
+
*
|
| 61 |
+
* @param {ClientRequest} Req Request object
|
| 62 |
+
* @param {IncomingMessage} Res Response object
|
| 63 |
+
* @param {Object} Options Config object passed to the proxy
|
| 64 |
+
*
|
| 65 |
+
* @api private
|
| 66 |
+
*/
|
| 67 |
+
|
| 68 |
+
XHeaders: function XHeaders(req, res, options) {
|
| 69 |
+
if(!options.xfwd) return;
|
| 70 |
+
|
| 71 |
+
var encrypted = req.isSpdy || common.hasEncryptedConnection(req);
|
| 72 |
+
var values = {
|
| 73 |
+
for : req.connection.remoteAddress || req.socket.remoteAddress,
|
| 74 |
+
port : common.getPort(req),
|
| 75 |
+
proto: encrypted ? 'https' : 'http'
|
| 76 |
+
};
|
| 77 |
+
|
| 78 |
+
['for', 'port', 'proto'].forEach(function(header) {
|
| 79 |
+
req.headers['x-forwarded-' + header] =
|
| 80 |
+
(req.headers['x-forwarded-' + header] || '') +
|
| 81 |
+
(req.headers['x-forwarded-' + header] ? ',' : '') +
|
| 82 |
+
values[header];
|
| 83 |
+
});
|
| 84 |
+
|
| 85 |
+
req.headers['x-forwarded-host'] = req.headers['x-forwarded-host'] || req.headers['host'] || '';
|
| 86 |
+
},
|
| 87 |
+
|
| 88 |
+
/**
|
| 89 |
+
* Does the actual proxying. If `forward` is enabled fires up
|
| 90 |
+
* a ForwardStream, same happens for ProxyStream. The request
|
| 91 |
+
* just dies otherwise.
|
| 92 |
+
*
|
| 93 |
+
* @param {ClientRequest} Req Request object
|
| 94 |
+
* @param {IncomingMessage} Res Response object
|
| 95 |
+
* @param {Object} Options Config object passed to the proxy
|
| 96 |
+
*
|
| 97 |
+
* @api private
|
| 98 |
+
*/
|
| 99 |
+
|
| 100 |
+
stream: function stream(req, res, options, _, server, clb) {
|
| 101 |
+
|
| 102 |
+
// And we begin!
|
| 103 |
+
server.emit('start', req, res, options.target || options.forward);
|
| 104 |
+
|
| 105 |
+
var agents = options.followRedirects ? followRedirects : nativeAgents;
|
| 106 |
+
var http = agents.http;
|
| 107 |
+
var https = agents.https;
|
| 108 |
+
|
| 109 |
+
if(options.forward) {
|
| 110 |
+
// If forward enable, so just pipe the request
|
| 111 |
+
var forwardReq = (options.forward.protocol === 'https:' ? https : http).request(
|
| 112 |
+
common.setupOutgoing(options.ssl || {}, options, req, 'forward')
|
| 113 |
+
);
|
| 114 |
+
|
| 115 |
+
// error handler (e.g. ECONNRESET, ECONNREFUSED)
|
| 116 |
+
// Handle errors on incoming request as well as it makes sense to
|
| 117 |
+
var forwardError = createErrorHandler(forwardReq, options.forward);
|
| 118 |
+
req.on('error', forwardError);
|
| 119 |
+
forwardReq.on('error', forwardError);
|
| 120 |
+
|
| 121 |
+
(options.buffer || req).pipe(forwardReq);
|
| 122 |
+
if(!options.target) { return res.end(); }
|
| 123 |
+
}
|
| 124 |
+
|
| 125 |
+
// Request initalization
|
| 126 |
+
var proxyReq = (options.target.protocol === 'https:' ? https : http).request(
|
| 127 |
+
common.setupOutgoing(options.ssl || {}, options, req)
|
| 128 |
+
);
|
| 129 |
+
|
| 130 |
+
// Enable developers to modify the proxyReq before headers are sent
|
| 131 |
+
proxyReq.on('socket', function(socket) {
|
| 132 |
+
if(server && !proxyReq.getHeader('expect')) {
|
| 133 |
+
server.emit('proxyReq', proxyReq, req, res, options);
|
| 134 |
+
}
|
| 135 |
+
});
|
| 136 |
+
|
| 137 |
+
// allow outgoing socket to timeout so that we could
|
| 138 |
+
// show an error page at the initial request
|
| 139 |
+
if(options.proxyTimeout) {
|
| 140 |
+
proxyReq.setTimeout(options.proxyTimeout, function() {
|
| 141 |
+
proxyReq.abort();
|
| 142 |
+
});
|
| 143 |
+
}
|
| 144 |
+
|
| 145 |
+
// Ensure we abort proxy if request is aborted
|
| 146 |
+
req.on('aborted', function () {
|
| 147 |
+
proxyReq.abort();
|
| 148 |
+
});
|
| 149 |
+
|
| 150 |
+
// handle errors in proxy and incoming request, just like for forward proxy
|
| 151 |
+
var proxyError = createErrorHandler(proxyReq, options.target);
|
| 152 |
+
req.on('error', proxyError);
|
| 153 |
+
proxyReq.on('error', proxyError);
|
| 154 |
+
|
| 155 |
+
function createErrorHandler(proxyReq, url) {
|
| 156 |
+
return function proxyError(err) {
|
| 157 |
+
if (req.socket.destroyed && err.code === 'ECONNRESET') {
|
| 158 |
+
server.emit('econnreset', err, req, res, url);
|
| 159 |
+
return proxyReq.abort();
|
| 160 |
+
}
|
| 161 |
+
|
| 162 |
+
if (clb) {
|
| 163 |
+
clb(err, req, res, url);
|
| 164 |
+
} else {
|
| 165 |
+
server.emit('error', err, req, res, url);
|
| 166 |
+
}
|
| 167 |
+
}
|
| 168 |
+
}
|
| 169 |
+
|
| 170 |
+
(options.buffer || req).pipe(proxyReq);
|
| 171 |
+
|
| 172 |
+
proxyReq.on('response', function(proxyRes) {
|
| 173 |
+
if(server) { server.emit('proxyRes', proxyRes, req, res); }
|
| 174 |
+
|
| 175 |
+
if(!res.headersSent && !options.selfHandleResponse) {
|
| 176 |
+
for(var i=0; i < web_o.length; i++) {
|
| 177 |
+
if(web_o[i](req, res, proxyRes, options)) { break; }
|
| 178 |
+
}
|
| 179 |
+
}
|
| 180 |
+
|
| 181 |
+
if (!res.finished) {
|
| 182 |
+
// Allow us to listen when the proxy has completed
|
| 183 |
+
proxyRes.on('end', function () {
|
| 184 |
+
if (server) server.emit('end', req, res, proxyRes);
|
| 185 |
+
});
|
| 186 |
+
// We pipe to the response unless its expected to be handled by the user
|
| 187 |
+
if (!options.selfHandleResponse) proxyRes.pipe(res);
|
| 188 |
+
} else {
|
| 189 |
+
if (server) server.emit('end', req, res, proxyRes);
|
| 190 |
+
}
|
| 191 |
+
});
|
| 192 |
+
}
|
| 193 |
+
|
| 194 |
+
};
|
`/Agents/influencer-thread-pipeline/.venv/Lib/site-packages/gradio/templates/node/build/node_modules/http-proxy/lib/http-proxy/passes/web-outgoing.js
ADDED
|
@@ -0,0 +1,147 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
var url = require('url'),
|
| 2 |
+
common = require('../common');
|
| 3 |
+
|
| 4 |
+
|
| 5 |
+
var redirectRegex = /^201|30(1|2|7|8)$/;
|
| 6 |
+
|
| 7 |
+
/*!
|
| 8 |
+
* Array of passes.
|
| 9 |
+
*
|
| 10 |
+
* A `pass` is just a function that is executed on `req, res, options`
|
| 11 |
+
* so that you can easily add new checks while still keeping the base
|
| 12 |
+
* flexible.
|
| 13 |
+
*/
|
| 14 |
+
|
| 15 |
+
module.exports = { // <--
|
| 16 |
+
|
| 17 |
+
/**
|
| 18 |
+
* If is a HTTP 1.0 request, remove chunk headers
|
| 19 |
+
*
|
| 20 |
+
* @param {ClientRequest} Req Request object
|
| 21 |
+
* @param {IncomingMessage} Res Response object
|
| 22 |
+
* @param {proxyResponse} Res Response object from the proxy request
|
| 23 |
+
*
|
| 24 |
+
* @api private
|
| 25 |
+
*/
|
| 26 |
+
removeChunked: function removeChunked(req, res, proxyRes) {
|
| 27 |
+
if (req.httpVersion === '1.0') {
|
| 28 |
+
delete proxyRes.headers['transfer-encoding'];
|
| 29 |
+
}
|
| 30 |
+
},
|
| 31 |
+
|
| 32 |
+
/**
|
| 33 |
+
* If is a HTTP 1.0 request, set the correct connection header
|
| 34 |
+
* or if connection header not present, then use `keep-alive`
|
| 35 |
+
*
|
| 36 |
+
* @param {ClientRequest} Req Request object
|
| 37 |
+
* @param {IncomingMessage} Res Response object
|
| 38 |
+
* @param {proxyResponse} Res Response object from the proxy request
|
| 39 |
+
*
|
| 40 |
+
* @api private
|
| 41 |
+
*/
|
| 42 |
+
setConnection: function setConnection(req, res, proxyRes) {
|
| 43 |
+
if (req.httpVersion === '1.0') {
|
| 44 |
+
proxyRes.headers.connection = req.headers.connection || 'close';
|
| 45 |
+
} else if (req.httpVersion !== '2.0' && !proxyRes.headers.connection) {
|
| 46 |
+
proxyRes.headers.connection = req.headers.connection || 'keep-alive';
|
| 47 |
+
}
|
| 48 |
+
},
|
| 49 |
+
|
| 50 |
+
setRedirectHostRewrite: function setRedirectHostRewrite(req, res, proxyRes, options) {
|
| 51 |
+
if ((options.hostRewrite || options.autoRewrite || options.protocolRewrite)
|
| 52 |
+
&& proxyRes.headers['location']
|
| 53 |
+
&& redirectRegex.test(proxyRes.statusCode)) {
|
| 54 |
+
var target = url.parse(options.target);
|
| 55 |
+
var u = url.parse(proxyRes.headers['location']);
|
| 56 |
+
|
| 57 |
+
// make sure the redirected host matches the target host before rewriting
|
| 58 |
+
if (target.host != u.host) {
|
| 59 |
+
return;
|
| 60 |
+
}
|
| 61 |
+
|
| 62 |
+
if (options.hostRewrite) {
|
| 63 |
+
u.host = options.hostRewrite;
|
| 64 |
+
} else if (options.autoRewrite) {
|
| 65 |
+
u.host = req.headers['host'];
|
| 66 |
+
}
|
| 67 |
+
if (options.protocolRewrite) {
|
| 68 |
+
u.protocol = options.protocolRewrite;
|
| 69 |
+
}
|
| 70 |
+
|
| 71 |
+
proxyRes.headers['location'] = u.format();
|
| 72 |
+
}
|
| 73 |
+
},
|
| 74 |
+
/**
|
| 75 |
+
* Copy headers from proxyResponse to response
|
| 76 |
+
* set each header in response object.
|
| 77 |
+
*
|
| 78 |
+
* @param {ClientRequest} Req Request object
|
| 79 |
+
* @param {IncomingMessage} Res Response object
|
| 80 |
+
* @param {proxyResponse} Res Response object from the proxy request
|
| 81 |
+
* @param {Object} Options options.cookieDomainRewrite: Config to rewrite cookie domain
|
| 82 |
+
*
|
| 83 |
+
* @api private
|
| 84 |
+
*/
|
| 85 |
+
writeHeaders: function writeHeaders(req, res, proxyRes, options) {
|
| 86 |
+
var rewriteCookieDomainConfig = options.cookieDomainRewrite,
|
| 87 |
+
rewriteCookiePathConfig = options.cookiePathRewrite,
|
| 88 |
+
preserveHeaderKeyCase = options.preserveHeaderKeyCase,
|
| 89 |
+
rawHeaderKeyMap,
|
| 90 |
+
setHeader = function(key, header) {
|
| 91 |
+
if (header == undefined) return;
|
| 92 |
+
if (rewriteCookieDomainConfig && key.toLowerCase() === 'set-cookie') {
|
| 93 |
+
header = common.rewriteCookieProperty(header, rewriteCookieDomainConfig, 'domain');
|
| 94 |
+
}
|
| 95 |
+
if (rewriteCookiePathConfig && key.toLowerCase() === 'set-cookie') {
|
| 96 |
+
header = common.rewriteCookieProperty(header, rewriteCookiePathConfig, 'path');
|
| 97 |
+
}
|
| 98 |
+
res.setHeader(String(key).trim(), header);
|
| 99 |
+
};
|
| 100 |
+
|
| 101 |
+
if (typeof rewriteCookieDomainConfig === 'string') { //also test for ''
|
| 102 |
+
rewriteCookieDomainConfig = { '*': rewriteCookieDomainConfig };
|
| 103 |
+
}
|
| 104 |
+
|
| 105 |
+
if (typeof rewriteCookiePathConfig === 'string') { //also test for ''
|
| 106 |
+
rewriteCookiePathConfig = { '*': rewriteCookiePathConfig };
|
| 107 |
+
}
|
| 108 |
+
|
| 109 |
+
// message.rawHeaders is added in: v0.11.6
|
| 110 |
+
// https://nodejs.org/api/http.html#http_message_rawheaders
|
| 111 |
+
if (preserveHeaderKeyCase && proxyRes.rawHeaders != undefined) {
|
| 112 |
+
rawHeaderKeyMap = {};
|
| 113 |
+
for (var i = 0; i < proxyRes.rawHeaders.length; i += 2) {
|
| 114 |
+
var key = proxyRes.rawHeaders[i];
|
| 115 |
+
rawHeaderKeyMap[key.toLowerCase()] = key;
|
| 116 |
+
}
|
| 117 |
+
}
|
| 118 |
+
|
| 119 |
+
Object.keys(proxyRes.headers).forEach(function(key) {
|
| 120 |
+
var header = proxyRes.headers[key];
|
| 121 |
+
if (preserveHeaderKeyCase && rawHeaderKeyMap) {
|
| 122 |
+
key = rawHeaderKeyMap[key] || key;
|
| 123 |
+
}
|
| 124 |
+
setHeader(key, header);
|
| 125 |
+
});
|
| 126 |
+
},
|
| 127 |
+
|
| 128 |
+
/**
|
| 129 |
+
* Set the statusCode from the proxyResponse
|
| 130 |
+
*
|
| 131 |
+
* @param {ClientRequest} Req Request object
|
| 132 |
+
* @param {IncomingMessage} Res Response object
|
| 133 |
+
* @param {proxyResponse} Res Response object from the proxy request
|
| 134 |
+
*
|
| 135 |
+
* @api private
|
| 136 |
+
*/
|
| 137 |
+
writeStatusCode: function writeStatusCode(req, res, proxyRes) {
|
| 138 |
+
// From Node.js docs: response.writeHead(statusCode[, statusMessage][, headers])
|
| 139 |
+
if(proxyRes.statusMessage) {
|
| 140 |
+
res.statusCode = proxyRes.statusCode;
|
| 141 |
+
res.statusMessage = proxyRes.statusMessage;
|
| 142 |
+
} else {
|
| 143 |
+
res.statusCode = proxyRes.statusCode;
|
| 144 |
+
}
|
| 145 |
+
}
|
| 146 |
+
|
| 147 |
+
};
|
`/Agents/influencer-thread-pipeline/.venv/Lib/site-packages/gradio/templates/node/build/node_modules/http-proxy/lib/http-pro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+
var http = require('http'),
|
| 2 |
+
https = require('https'),
|
| 3 |
+
common = require('../common');
|
| 4 |
+
|
| 5 |
+
/*!
|
| 6 |
+
* Array of passes.
|
| 7 |
+
*
|
| 8 |
+
* A `pass` is just a function that is executed on `req, socket, options`
|
| 9 |
+
* so that you can easily add new checks while still keeping the base
|
| 10 |
+
* flexible.
|
| 11 |
+
*/
|
| 12 |
+
|
| 13 |
+
/*
|
| 14 |
+
* Websockets Passes
|
| 15 |
+
*
|
| 16 |
+
*/
|
| 17 |
+
|
| 18 |
+
|
| 19 |
+
module.exports = {
|
| 20 |
+
/**
|
| 21 |
+
* WebSocket requests must have the `GET` method and
|
| 22 |
+
* the `upgrade:websocket` header
|
| 23 |
+
*
|
| 24 |
+
* @param {ClientRequest} Req Request object
|
| 25 |
+
* @param {Socket} Websocket
|
| 26 |
+
*
|
| 27 |
+
* @api private
|
| 28 |
+
*/
|
| 29 |
+
|
| 30 |
+
checkMethodAndHeader : function checkMethodAndHeader(req, socket) {
|
| 31 |
+
if (req.method !== 'GET' || !req.headers.upgrade) {
|
| 32 |
+
socket.destroy();
|
| 33 |
+
return true;
|
| 34 |
+
}
|
| 35 |
+
|
| 36 |
+
if (req.headers.upgrade.toLowerCase() !== 'websocket') {
|
| 37 |
+
socket.destroy();
|
| 38 |
+
return true;
|
| 39 |
+
}
|
| 40 |
+
},
|
| 41 |
+
|
| 42 |
+
/**
|
| 43 |
+
* Sets `x-forwarded-*` headers if specified in config.
|
| 44 |
+
*
|
| 45 |
+
* @param {ClientRequest} Req Request object
|
| 46 |
+
* @param {Socket} Websocket
|
| 47 |
+
* @param {Object} Options Config object passed to the proxy
|
| 48 |
+
*
|
| 49 |
+
* @api private
|
| 50 |
+
*/
|
| 51 |
+
|
| 52 |
+
XHeaders : function XHeaders(req, socket, options) {
|
| 53 |
+
if(!options.xfwd) return;
|
| 54 |
+
|
| 55 |
+
var values = {
|
| 56 |
+
for : req.connection.remoteAddress || req.socket.remoteAddress,
|
| 57 |
+
port : common.getPort(req),
|
| 58 |
+
proto: common.hasEncryptedConnection(req) ? 'wss' : 'ws'
|
| 59 |
+
};
|
| 60 |
+
|
| 61 |
+
['for', 'port', 'proto'].forEach(function(header) {
|
| 62 |
+
req.headers['x-forwarded-' + header] =
|
| 63 |
+
(req.headers['x-forwarded-' + header] || '') +
|
| 64 |
+
(req.headers['x-forwarded-' + header] ? ',' : '') +
|
| 65 |
+
values[header];
|
| 66 |
+
});
|
| 67 |
+
},
|
| 68 |
+
|
| 69 |
+
/**
|
| 70 |
+
* Does the actual proxying. Make the request and upgrade it
|
| 71 |
+
* send the Switching Protocols request and pipe the sockets.
|
| 72 |
+
*
|
| 73 |
+
* @param {ClientRequest} Req Request object
|
| 74 |
+
* @param {Socket} Websocket
|
| 75 |
+
* @param {Object} Options Config object passed to the proxy
|
| 76 |
+
*
|
| 77 |
+
* @api private
|
| 78 |
+
*/
|
| 79 |
+
stream : function stream(req, socket, options, head, server, clb) {
|
| 80 |
+
|
| 81 |
+
var createHttpHeader = function(line, headers) {
|
| 82 |
+
return Object.keys(headers).reduce(function (head, key) {
|
| 83 |
+
var value = headers[key];
|
| 84 |
+
|
| 85 |
+
if (!Array.isArray(value)) {
|
| 86 |
+
head.push(key + ': ' + value);
|
| 87 |
+
return head;
|
| 88 |
+
}
|
| 89 |
+
|
| 90 |
+
for (var i = 0; i < value.length; i++) {
|
| 91 |
+
head.push(key + ': ' + value[i]);
|
| 92 |
+
}
|
| 93 |
+
return head;
|
| 94 |
+
}, [line])
|
| 95 |
+
.join('\r\n') + '\r\n\r\n';
|
| 96 |
+
}
|
| 97 |
+
|
| 98 |
+
common.setupSocket(socket);
|
| 99 |
+
|
| 100 |
+
if (head && head.length) socket.unshift(head);
|
| 101 |
+
|
| 102 |
+
|
| 103 |
+
var proxyReq = (common.isSSL.test(options.target.protocol) ? https : http).request(
|
| 104 |
+
common.setupOutgoing(options.ssl || {}, options, req)
|
| 105 |
+
);
|
| 106 |
+
|
| 107 |
+
// Enable developers to modify the proxyReq before headers are sent
|
| 108 |
+
if (server) { server.emit('proxyReqWs', proxyReq, req, socket, options, head); }
|
| 109 |
+
|
| 110 |
+
// Error Handler
|
| 111 |
+
proxyReq.on('error', onOutgoingError);
|
| 112 |
+
proxyReq.on('response', function (res) {
|
| 113 |
+
// if upgrade event isn't going to happen, close the socket
|
| 114 |
+
if (!res.upgrade) {
|
| 115 |
+
socket.write(createHttpHeader('HTTP/' + res.httpVersion + ' ' + res.statusCode + ' ' + res.statusMessage, res.headers));
|
| 116 |
+
res.pipe(socket);
|
| 117 |
+
}
|
| 118 |
+
});
|
| 119 |
+
|
| 120 |
+
proxyReq.on('upgrade', function(proxyRes, proxySocket, proxyHead) {
|
| 121 |
+
proxySocket.on('error', onOutgoingError);
|
| 122 |
+
|
| 123 |
+
// Allow us to listen when the websocket has completed
|
| 124 |
+
proxySocket.on('end', function () {
|
| 125 |
+
server.emit('close', proxyRes, proxySocket, proxyHead);
|
| 126 |
+
});
|
| 127 |
+
|
| 128 |
+
// The pipe below will end proxySocket if socket closes cleanly, but not
|
| 129 |
+
// if it errors (eg, vanishes from the net and starts returning
|
| 130 |
+
// EHOSTUNREACH). We need to do that explicitly.
|
| 131 |
+
socket.on('error', function () {
|
| 132 |
+
proxySocket.end();
|
| 133 |
+
});
|
| 134 |
+
|
| 135 |
+
common.setupSocket(proxySocket);
|
| 136 |
+
|
| 137 |
+
if (proxyHead && proxyHead.length) proxySocket.unshift(proxyHead);
|
| 138 |
+
|
| 139 |
+
//
|
| 140 |
+
// Remark: Handle writing the headers to the socket when switching protocols
|
| 141 |
+
// Also handles when a header is an array
|
| 142 |
+
//
|
| 143 |
+
socket.write(createHttpHeader('HTTP/1.1 101 Switching Protocols', proxyRes.headers));
|
| 144 |
+
|
| 145 |
+
proxySocket.pipe(socket).pipe(proxySocket);
|
| 146 |
+
|
| 147 |
+
server.emit('open', proxySocket);
|
| 148 |
+
server.emit('proxySocket', proxySocket); //DEPRECATED.
|
| 149 |
+
});
|
| 150 |
+
|
| 151 |
+
return proxyReq.end(); // XXX: CHECK IF THIS IS THIS CORRECT
|
| 152 |
+
|
| 153 |
+
function onOutgoingError(err) {
|
| 154 |
+
if (clb) {
|
| 155 |
+
clb(err, req, socket);
|
| 156 |
+
} else {
|
| 157 |
+
server.emit('error', err, req, socket);
|
| 158 |
+
}
|
| 159 |
+
socket.end();
|
| 160 |
+
}
|
| 161 |
+
}
|
| 162 |
+
};
|
`/Agents/influencer-thread-pipeline/.venv/Lib/site-packages/gradio/templates/node/build/node_modules/http-proxy/package.json
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"name": "http-proxy",
|
| 3 |
+
"version": "1.18.1",
|
| 4 |
+
"repository": {
|
| 5 |
+
"type": "git",
|
| 6 |
+
"url": "https://github.com/http-party/node-http-proxy.git"
|
| 7 |
+
},
|
| 8 |
+
"description": "HTTP proxying for the masses",
|
| 9 |
+
"author": "Charlie Robbins <charlie.robbins@gmail.com>",
|
| 10 |
+
"maintainers": [
|
| 11 |
+
"jcrugzz <jcrugzz@gmail.com>"
|
| 12 |
+
],
|
| 13 |
+
"main": "index.js",
|
| 14 |
+
"dependencies": {
|
| 15 |
+
"eventemitter3": "^4.0.0",
|
| 16 |
+
"requires-port": "^1.0.0",
|
| 17 |
+
"follow-redirects": "^1.0.0"
|
| 18 |
+
},
|
| 19 |
+
"devDependencies": {
|
| 20 |
+
"async": "^3.0.0",
|
| 21 |
+
"auto-changelog": "^1.15.0",
|
| 22 |
+
"concat-stream": "^2.0.0",
|
| 23 |
+
"expect.js": "~0.3.1",
|
| 24 |
+
"mocha": "^3.5.3",
|
| 25 |
+
"nyc": "^14.0.0",
|
| 26 |
+
"semver": "^5.0.3",
|
| 27 |
+
"socket.io": "^2.1.0",
|
| 28 |
+
"socket.io-client": "^2.1.0",
|
| 29 |
+
"sse": "0.0.8",
|
| 30 |
+
"ws": "^3.0.0"
|
| 31 |
+
},
|
| 32 |
+
"scripts": {
|
| 33 |
+
"mocha": "mocha test/*-test.js",
|
| 34 |
+
"test": "nyc --reporter=text --reporter=lcov npm run mocha",
|
| 35 |
+
"version": "auto-changelog -p && git add CHANGELOG.md"
|
| 36 |
+
},
|
| 37 |
+
"engines": {
|
| 38 |
+
"node": ">=8.0.0"
|
| 39 |
+
},
|
| 40 |
+
"license": "MIT"
|
| 41 |
+
}
|
`/Agents/influencer-thread-pipeline/.venv/Lib/site-packages/gradio/templates/node/build/node_modules/http-proxy/renovate.json
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"platform": "github",
|
| 3 |
+
"autodiscover": false,
|
| 4 |
+
"requireConfig": true,
|
| 5 |
+
"ignoreNpmrcFile": true,
|
| 6 |
+
"rangeStrategy": "replace",
|
| 7 |
+
"packageRules": [
|
| 8 |
+
{
|
| 9 |
+
"packagePatterns": [
|
| 10 |
+
"*"
|
| 11 |
+
],
|
| 12 |
+
"minor": {
|
| 13 |
+
"groupName": "all non-major dependencies",
|
| 14 |
+
"groupSlug": "all-minor-patch"
|
| 15 |
+
}
|
| 16 |
+
}
|
| 17 |
+
],
|
| 18 |
+
"commitMessagePrefix": "[dist]"
|
| 19 |
+
}
|
`/Agents/influencer-thread-pipeline/.venv/Lib/site-packages/gradio/templates/node/build/node_modules/requires-port/.npmignore
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
|
|
|
| 1 |
+
node_modules
|
| 2 |
+
coverage
|
`/Agents/influencer-thread-pipeline/.venv/Lib/site-packages/gradio/templates/node/build/node_modules/requires-port/.travis.yml
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
sudo: false
|
| 2 |
+
language: node_js
|
| 3 |
+
node_js:
|
| 4 |
+
- "4"
|
| 5 |
+
- "iojs"
|
| 6 |
+
- "0.12"
|
| 7 |
+
- "0.10"
|
| 8 |
+
script:
|
| 9 |
+
- "npm run test-travis"
|
| 10 |
+
after_script:
|
| 11 |
+
- "npm install coveralls@2 && cat coverage/lcov.info | coveralls"
|
| 12 |
+
matrix:
|
| 13 |
+
fast_finish: true
|
| 14 |
+
notifications:
|
| 15 |
+
irc:
|
| 16 |
+
channels:
|
| 17 |
+
- "irc.freenode.org#unshift"
|
| 18 |
+
on_success: change
|
| 19 |
+
on_failure: change
|
`/Agents/influencer-thread-pipeline/.venv/Lib/site-packages/gradio/templates/node/build/node_modules/requires-port/LICENSE
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
The MIT License (MIT)
|
| 2 |
+
|
| 3 |
+
Copyright (c) 2015 Unshift.io, Arnout Kazemier, the Contributors.
|
| 4 |
+
|
| 5 |
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
| 6 |
+
of this software and associated documentation files (the "Software"), to deal
|
| 7 |
+
in the Software without restriction, including without limitation the rights
|
| 8 |
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
| 9 |
+
copies of the Software, and to permit persons to whom the Software is
|
| 10 |
+
furnished to do so, subject to the following conditions:
|
| 11 |
+
|
| 12 |
+
The above copyright notice and this permission notice shall be included in all
|
| 13 |
+
copies or substantial portions of the Software.
|
| 14 |
+
|
| 15 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
| 16 |
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
| 17 |
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
| 18 |
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
| 19 |
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
| 20 |
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
| 21 |
+
SOFTWARE.
|
| 22 |
+
|
`/Agents/influencer-thread-pipeline/.venv/Lib/site-packages/gradio/templates/node/build/node_modules/requires-port/README.md
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# requires-port
|
| 2 |
+
|
| 3 |
+
[](http://unshift.io)[](http://browsenpm.org/package/requires-port)[](https://travis-ci.org/unshiftio/requires-port)[](https://david-dm.org/unshiftio/requires-port)[](https://coveralls.io/r/unshiftio/requires-port?branch=master)[](http://webchat.freenode.net/?channels=unshift)
|
| 4 |
+
|
| 5 |
+
The module name says it all, check if a protocol requires a given port.
|
| 6 |
+
|
| 7 |
+
## Installation
|
| 8 |
+
|
| 9 |
+
This module is intended to be used with browserify or Node.js and is distributed
|
| 10 |
+
in the public npm registry. To install it simply run the following command from
|
| 11 |
+
your CLI:
|
| 12 |
+
|
| 13 |
+
```j
|
| 14 |
+
npm install --save requires-port
|
| 15 |
+
```
|
| 16 |
+
|
| 17 |
+
## Usage
|
| 18 |
+
|
| 19 |
+
The module exports it self as function and requires 2 arguments:
|
| 20 |
+
|
| 21 |
+
1. The port number, can be a string or number.
|
| 22 |
+
2. Protocol, can be `http`, `http:` or even `https://yomoma.com`. We just split
|
| 23 |
+
it at `:` and use the first result. We currently accept the following
|
| 24 |
+
protocols:
|
| 25 |
+
- `http`
|
| 26 |
+
- `https`
|
| 27 |
+
- `ws`
|
| 28 |
+
- `wss`
|
| 29 |
+
- `ftp`
|
| 30 |
+
- `gopher`
|
| 31 |
+
- `file`
|
| 32 |
+
|
| 33 |
+
It returns a boolean that indicates if protocol requires this port to be added
|
| 34 |
+
to your URL.
|
| 35 |
+
|
| 36 |
+
```js
|
| 37 |
+
'use strict';
|
| 38 |
+
|
| 39 |
+
var required = require('requires-port');
|
| 40 |
+
|
| 41 |
+
console.log(required('8080', 'http')) // true
|
| 42 |
+
console.log(required('80', 'http')) // false
|
| 43 |
+
```
|
| 44 |
+
|
| 45 |
+
# License
|
| 46 |
+
|
| 47 |
+
MIT
|
`/Agents/influencer-thread-pipeline/.venv/Lib/site-packages/gradio/templates/node/build/node_modules/requires-port/index.js
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
'use strict';
|
| 2 |
+
|
| 3 |
+
/**
|
| 4 |
+
* Check if we're required to add a port number.
|
| 5 |
+
*
|
| 6 |
+
* @see https://url.spec.whatwg.org/#default-port
|
| 7 |
+
* @param {Number|String} port Port number we need to check
|
| 8 |
+
* @param {String} protocol Protocol we need to check against.
|
| 9 |
+
* @returns {Boolean} Is it a default port for the given protocol
|
| 10 |
+
* @api private
|
| 11 |
+
*/
|
| 12 |
+
module.exports = function required(port, protocol) {
|
| 13 |
+
protocol = protocol.split(':')[0];
|
| 14 |
+
port = +port;
|
| 15 |
+
|
| 16 |
+
if (!port) return false;
|
| 17 |
+
|
| 18 |
+
switch (protocol) {
|
| 19 |
+
case 'http':
|
| 20 |
+
case 'ws':
|
| 21 |
+
return port !== 80;
|
| 22 |
+
|
| 23 |
+
case 'https':
|
| 24 |
+
case 'wss':
|
| 25 |
+
return port !== 443;
|
| 26 |
+
|
| 27 |
+
case 'ftp':
|
| 28 |
+
return port !== 21;
|
| 29 |
+
|
| 30 |
+
case 'gopher':
|
| 31 |
+
return port !== 70;
|
| 32 |
+
|
| 33 |
+
case 'file':
|
| 34 |
+
return false;
|
| 35 |
+
}
|
| 36 |
+
|
| 37 |
+
return port !== 0;
|
| 38 |
+
};
|
`/Agents/influencer-thread-pipeline/.venv/Lib/site-packages/gradio/templates/node/build/node_modules/requires-port/package.json
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"name": "requires-port",
|
| 3 |
+
"version": "1.0.0",
|
| 4 |
+
"description": "Check if a protocol requires a certain port number to be added to an URL.",
|
| 5 |
+
"main": "index.js",
|
| 6 |
+
"scripts": {
|
| 7 |
+
"100%": "istanbul check-coverage --statements 100 --functions 100 --lines 100 --branches 100",
|
| 8 |
+
"test-travis": "istanbul cover _mocha --report lcovonly -- test.js",
|
| 9 |
+
"coverage": "istanbul cover _mocha -- test.js",
|
| 10 |
+
"watch": "mocha --watch test.js",
|
| 11 |
+
"test": "mocha test.js"
|
| 12 |
+
},
|
| 13 |
+
"repository": {
|
| 14 |
+
"type": "git",
|
| 15 |
+
"url": "https://github.com/unshiftio/requires-port"
|
| 16 |
+
},
|
| 17 |
+
"keywords": [
|
| 18 |
+
"port",
|
| 19 |
+
"require",
|
| 20 |
+
"http",
|
| 21 |
+
"https",
|
| 22 |
+
"ws",
|
| 23 |
+
"wss",
|
| 24 |
+
"gopher",
|
| 25 |
+
"file",
|
| 26 |
+
"ftp",
|
| 27 |
+
"requires",
|
| 28 |
+
"requried",
|
| 29 |
+
"portnumber",
|
| 30 |
+
"url",
|
| 31 |
+
"parsing",
|
| 32 |
+
"validation",
|
| 33 |
+
"cows"
|
| 34 |
+
],
|
| 35 |
+
"author": "Arnout Kazemier",
|
| 36 |
+
"license": "MIT",
|
| 37 |
+
"bugs": {
|
| 38 |
+
"url": "https://github.com/unshiftio/requires-port/issues"
|
| 39 |
+
},
|
| 40 |
+
"homepage": "https://github.com/unshiftio/requires-port",
|
| 41 |
+
"devDependencies": {
|
| 42 |
+
"assume": "1.3.x",
|
| 43 |
+
"istanbul": "0.4.x",
|
| 44 |
+
"mocha": "2.3.x",
|
| 45 |
+
"pre-commit": "1.1.x"
|
| 46 |
+
}
|
| 47 |
+
}
|
`/Agents/influencer-thread-pipeline/.venv/Lib/site-packages/gradio/templates/node/build/node_modules/requires-port/test.js
ADDED
|
@@ -0,0 +1,98 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
describe('requires-port', function () {
|
| 2 |
+
'use strict';
|
| 3 |
+
|
| 4 |
+
var assume = require('assume')
|
| 5 |
+
, required = require('./');
|
| 6 |
+
|
| 7 |
+
it('is exported as a function', function () {
|
| 8 |
+
assume(required).is.a('function');
|
| 9 |
+
});
|
| 10 |
+
|
| 11 |
+
it('does not require empty ports', function () {
|
| 12 |
+
assume(required('', 'http')).false();
|
| 13 |
+
assume(required('', 'wss')).false();
|
| 14 |
+
assume(required('', 'ws')).false();
|
| 15 |
+
assume(required('', 'cowsack')).false();
|
| 16 |
+
});
|
| 17 |
+
|
| 18 |
+
it('assumes true for unknown protocols',function () {
|
| 19 |
+
assume(required('808', 'foo')).true();
|
| 20 |
+
assume(required('80', 'bar')).true();
|
| 21 |
+
});
|
| 22 |
+
|
| 23 |
+
it('never requires port numbers for file', function () {
|
| 24 |
+
assume(required(8080, 'file')).false();
|
| 25 |
+
});
|
| 26 |
+
|
| 27 |
+
it('does not require port 80 for http', function () {
|
| 28 |
+
assume(required('80', 'http')).false();
|
| 29 |
+
assume(required(80, 'http')).false();
|
| 30 |
+
assume(required(80, 'http://')).false();
|
| 31 |
+
assume(required(80, 'http://www.google.com')).false();
|
| 32 |
+
|
| 33 |
+
assume(required('8080', 'http')).true();
|
| 34 |
+
assume(required(8080, 'http')).true();
|
| 35 |
+
assume(required(8080, 'http://')).true();
|
| 36 |
+
assume(required(8080, 'http://www.google.com')).true();
|
| 37 |
+
});
|
| 38 |
+
|
| 39 |
+
it('does not require port 80 for ws', function () {
|
| 40 |
+
assume(required('80', 'ws')).false();
|
| 41 |
+
assume(required(80, 'ws')).false();
|
| 42 |
+
assume(required(80, 'ws://')).false();
|
| 43 |
+
assume(required(80, 'ws://www.google.com')).false();
|
| 44 |
+
|
| 45 |
+
assume(required('8080', 'ws')).true();
|
| 46 |
+
assume(required(8080, 'ws')).true();
|
| 47 |
+
assume(required(8080, 'ws://')).true();
|
| 48 |
+
assume(required(8080, 'ws://www.google.com')).true();
|
| 49 |
+
});
|
| 50 |
+
|
| 51 |
+
it('does not require port 443 for https', function () {
|
| 52 |
+
assume(required('443', 'https')).false();
|
| 53 |
+
assume(required(443, 'https')).false();
|
| 54 |
+
assume(required(443, 'https://')).false();
|
| 55 |
+
assume(required(443, 'https://www.google.com')).false();
|
| 56 |
+
|
| 57 |
+
assume(required('8080', 'https')).true();
|
| 58 |
+
assume(required(8080, 'https')).true();
|
| 59 |
+
assume(required(8080, 'https://')).true();
|
| 60 |
+
assume(required(8080, 'https://www.google.com')).true();
|
| 61 |
+
});
|
| 62 |
+
|
| 63 |
+
it('does not require port 443 for wss', function () {
|
| 64 |
+
assume(required('443', 'wss')).false();
|
| 65 |
+
assume(required(443, 'wss')).false();
|
| 66 |
+
assume(required(443, 'wss://')).false();
|
| 67 |
+
assume(required(443, 'wss://www.google.com')).false();
|
| 68 |
+
|
| 69 |
+
assume(required('8080', 'wss')).true();
|
| 70 |
+
assume(required(8080, 'wss')).true();
|
| 71 |
+
assume(required(8080, 'wss://')).true();
|
| 72 |
+
assume(required(8080, 'wss://www.google.com')).true();
|
| 73 |
+
});
|
| 74 |
+
|
| 75 |
+
it('does not require port 21 for ftp', function () {
|
| 76 |
+
assume(required('21', 'ftp')).false();
|
| 77 |
+
assume(required(21, 'ftp')).false();
|
| 78 |
+
assume(required(21, 'ftp://')).false();
|
| 79 |
+
assume(required(21, 'ftp://www.google.com')).false();
|
| 80 |
+
|
| 81 |
+
assume(required('8080', 'ftp')).true();
|
| 82 |
+
assume(required(8080, 'ftp')).true();
|
| 83 |
+
assume(required(8080, 'ftp://')).true();
|
| 84 |
+
assume(required(8080, 'ftp://www.google.com')).true();
|
| 85 |
+
});
|
| 86 |
+
|
| 87 |
+
it('does not require port 70 for gopher', function () {
|
| 88 |
+
assume(required('70', 'gopher')).false();
|
| 89 |
+
assume(required(70, 'gopher')).false();
|
| 90 |
+
assume(required(70, 'gopher://')).false();
|
| 91 |
+
assume(required(70, 'gopher://www.google.com')).false();
|
| 92 |
+
|
| 93 |
+
assume(required('8080', 'gopher')).true();
|
| 94 |
+
assume(required(8080, 'gopher')).true();
|
| 95 |
+
assume(required(8080, 'gopher://')).true();
|
| 96 |
+
assume(required(8080, 'gopher://www.google.com')).true();
|
| 97 |
+
});
|
| 98 |
+
});
|
`/Agents/influencer-thread-pipeline/.venv/Lib/site-packages/gradio/templates/node/build/package-lock.json
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"name": "gradio-server-app",
|
| 3 |
+
"lockfileVersion": 3,
|
| 4 |
+
"requires": true,
|
| 5 |
+
"packages": {
|
| 6 |
+
"": {
|
| 7 |
+
"name": "gradio-server-app",
|
| 8 |
+
"dependencies": {
|
| 9 |
+
"http-proxy": "^1.18.1"
|
| 10 |
+
}
|
| 11 |
+
},
|
| 12 |
+
"node_modules/eventemitter3": {
|
| 13 |
+
"version": "4.0.7",
|
| 14 |
+
"resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-4.0.7.tgz",
|
| 15 |
+
"integrity": "sha512-8guHBZCwKnFhYdHr2ysuRWErTwhoN2X8XELRlrRwpmfeY2jjuUN4taQMsULKUVo1K4DvZl+0pgfyoysHxvmvEw==",
|
| 16 |
+
"license": "MIT"
|
| 17 |
+
},
|
| 18 |
+
"node_modules/follow-redirects": {
|
| 19 |
+
"version": "1.16.0",
|
| 20 |
+
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.16.0.tgz",
|
| 21 |
+
"integrity": "sha512-y5rN/uOsadFT/JfYwhxRS5R7Qce+g3zG97+JrtFZlC9klX/W5hD7iiLzScI4nZqUS7DNUdhPgw4xI8W2LuXlUw==",
|
| 22 |
+
"funding": [
|
| 23 |
+
{
|
| 24 |
+
"type": "individual",
|
| 25 |
+
"url": "https://github.com/sponsors/RubenVerborgh"
|
| 26 |
+
}
|
| 27 |
+
],
|
| 28 |
+
"license": "MIT",
|
| 29 |
+
"engines": {
|
| 30 |
+
"node": ">=4.0"
|
| 31 |
+
},
|
| 32 |
+
"peerDependenciesMeta": {
|
| 33 |
+
"debug": {
|
| 34 |
+
"optional": true
|
| 35 |
+
}
|
| 36 |
+
}
|
| 37 |
+
},
|
| 38 |
+
"node_modules/http-proxy": {
|
| 39 |
+
"version": "1.18.1",
|
| 40 |
+
"resolved": "https://registry.npmjs.org/http-proxy/-/http-proxy-1.18.1.tgz",
|
| 41 |
+
"integrity": "sha512-7mz/721AbnJwIVbnaSv1Cz3Am0ZLT/UBwkC92VlxhXv/k/BBQfM2fXElQNC27BVGr0uwUpplYPQM9LnaBMR5NQ==",
|
| 42 |
+
"license": "MIT",
|
| 43 |
+
"dependencies": {
|
| 44 |
+
"eventemitter3": "^4.0.0",
|
| 45 |
+
"follow-redirects": "^1.0.0",
|
| 46 |
+
"requires-port": "^1.0.0"
|
| 47 |
+
},
|
| 48 |
+
"engines": {
|
| 49 |
+
"node": ">=8.0.0"
|
| 50 |
+
}
|
| 51 |
+
},
|
| 52 |
+
"node_modules/requires-port": {
|
| 53 |
+
"version": "1.0.0",
|
| 54 |
+
"resolved": "https://registry.npmjs.org/requires-port/-/requires-port-1.0.0.tgz",
|
| 55 |
+
"integrity": "sha512-KigOCHcocU3XODJxsu8i/j8T9tzT4adHiecwORRQ0ZZFcp7ahwXuRU1m+yuO90C5ZUyGeGfocHDI14M3L3yDAQ==",
|
| 56 |
+
"license": "MIT"
|
| 57 |
+
}
|
| 58 |
+
}
|
| 59 |
+
}
|
`/Agents/influencer-thread-pipeline/.venv/Lib/site-packages/gradio/templates/node/build/package.json
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"name": "gradio-server-app",
|
| 3 |
+
"type": "module",
|
| 4 |
+
"dependencies": {
|
| 5 |
+
"http-proxy": "^1.18.1"
|
| 6 |
+
}
|
| 7 |
+
}
|
`/Agents/influencer-thread-pipeline/.venv/Lib/site-packages/gradio/templates/node/build/proxy_routes.js
ADDED
|
@@ -0,0 +1,133 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/**
|
| 2 |
+
* Routing logic for the Gradio Node proxy.
|
| 3 |
+
*
|
| 4 |
+
* Extracted so it can be unit-tested independently of the SvelteKit handler.
|
| 5 |
+
*/
|
| 6 |
+
|
| 7 |
+
// Routes that must go to the Python server (FastAPI).
|
| 8 |
+
export const PYTHON_ROUTE_PREFIXES = [
|
| 9 |
+
"/gradio_api",
|
| 10 |
+
"/config",
|
| 11 |
+
"/login",
|
| 12 |
+
"/logout",
|
| 13 |
+
"/theme.css",
|
| 14 |
+
"/robots.txt",
|
| 15 |
+
"/pwa_icon",
|
| 16 |
+
"/manifest.json",
|
| 17 |
+
"/monitoring"
|
| 18 |
+
];
|
| 19 |
+
|
| 20 |
+
// Routes that can be offloaded to static workers.
|
| 21 |
+
// Workers serve both /upload and /gradio_api/upload (same handler).
|
| 22 |
+
// Checked BEFORE the /gradio_api Python catch-all.
|
| 23 |
+
export const STATIC_ROUTE_PREFIXES = [
|
| 24 |
+
"/gradio_api/upload",
|
| 25 |
+
"/gradio_api/upload_progress",
|
| 26 |
+
"/gradio_api/file=",
|
| 27 |
+
"/gradio_api/file/",
|
| 28 |
+
"/upload",
|
| 29 |
+
"/upload_progress",
|
| 30 |
+
"/file=",
|
| 31 |
+
"/file/",
|
| 32 |
+
"/static/",
|
| 33 |
+
"/assets/",
|
| 34 |
+
"/svelte/",
|
| 35 |
+
"/favicon.ico",
|
| 36 |
+
"/custom_component/"
|
| 37 |
+
];
|
| 38 |
+
|
| 39 |
+
// Upload routes that need affinity (upload + upload_progress for the same
|
| 40 |
+
// upload_id must land on the same worker).
|
| 41 |
+
const UPLOAD_AFFINITY_PREFIXES = [
|
| 42 |
+
"/gradio_api/upload",
|
| 43 |
+
"/gradio_api/upload_progress",
|
| 44 |
+
"/upload",
|
| 45 |
+
"/upload_progress"
|
| 46 |
+
];
|
| 47 |
+
|
| 48 |
+
export function matchesPrefix(path, prefixes) {
|
| 49 |
+
for (const prefix of prefixes) {
|
| 50 |
+
if (path === prefix || path.startsWith(prefix)) {
|
| 51 |
+
return true;
|
| 52 |
+
}
|
| 53 |
+
}
|
| 54 |
+
return false;
|
| 55 |
+
}
|
| 56 |
+
|
| 57 |
+
/**
|
| 58 |
+
* Simple string hash (djb2) that returns a non-negative integer.
|
| 59 |
+
* Used to map upload_id to a deterministic worker index.
|
| 60 |
+
*
|
| 61 |
+
* @param {string} str
|
| 62 |
+
* @returns {number}
|
| 63 |
+
*/
|
| 64 |
+
export function hashString(str) {
|
| 65 |
+
let hash = 5381;
|
| 66 |
+
for (let i = 0; i < str.length; i++) {
|
| 67 |
+
hash = ((hash << 5) + hash + str.charCodeAt(i)) >>> 0;
|
| 68 |
+
}
|
| 69 |
+
return hash;
|
| 70 |
+
}
|
| 71 |
+
|
| 72 |
+
/**
|
| 73 |
+
* Classify a request into a routing destination and optional worker index.
|
| 74 |
+
*
|
| 75 |
+
* @param {string} path - URL path (no query string)
|
| 76 |
+
* @param {object} options
|
| 77 |
+
* @param {boolean} options.hasWorkers - whether static workers are configured
|
| 78 |
+
* @param {boolean} options.serverModeEnabled - whether GRADIO_SERVER_MODE_ENABLED is set
|
| 79 |
+
* @param {number} options.numWorkers - number of static workers
|
| 80 |
+
* @param {string} [options.queryString] - raw query string (after ?)
|
| 81 |
+
* @returns {{route: "worker" | "python" | "sveltekit", workerIndex?: number}}
|
| 82 |
+
*/
|
| 83 |
+
export function classifyRoute(
|
| 84 |
+
path,
|
| 85 |
+
{
|
| 86 |
+
hasWorkers = false,
|
| 87 |
+
serverModeEnabled = false,
|
| 88 |
+
numWorkers = 0,
|
| 89 |
+
queryString = ""
|
| 90 |
+
} = {}
|
| 91 |
+
) {
|
| 92 |
+
if (matchesPrefix(path, STATIC_ROUTE_PREFIXES)) {
|
| 93 |
+
if (!hasWorkers) {
|
| 94 |
+
return { route: "python" };
|
| 95 |
+
}
|
| 96 |
+
// For upload routes with an upload_id, use affinity hashing
|
| 97 |
+
if (
|
| 98 |
+
numWorkers > 0 &&
|
| 99 |
+
queryString &&
|
| 100 |
+
matchesPrefix(path, UPLOAD_AFFINITY_PREFIXES)
|
| 101 |
+
) {
|
| 102 |
+
const uploadId = extractUploadId(queryString);
|
| 103 |
+
if (uploadId) {
|
| 104 |
+
return {
|
| 105 |
+
route: "worker",
|
| 106 |
+
workerIndex: hashString(uploadId) % numWorkers
|
| 107 |
+
};
|
| 108 |
+
}
|
| 109 |
+
}
|
| 110 |
+
return { route: "worker" };
|
| 111 |
+
}
|
| 112 |
+
if (matchesPrefix(path, PYTHON_ROUTE_PREFIXES) || serverModeEnabled) {
|
| 113 |
+
return { route: "python" };
|
| 114 |
+
}
|
| 115 |
+
return { route: "sveltekit" };
|
| 116 |
+
}
|
| 117 |
+
|
| 118 |
+
/**
|
| 119 |
+
* Extract upload_id from a query string.
|
| 120 |
+
*
|
| 121 |
+
* @param {string} qs - raw query string (without leading ?)
|
| 122 |
+
* @returns {string|null}
|
| 123 |
+
*/
|
| 124 |
+
function extractUploadId(qs) {
|
| 125 |
+
for (const part of qs.split("&")) {
|
| 126 |
+
const eq = part.indexOf("=");
|
| 127 |
+
if (eq === -1) continue;
|
| 128 |
+
if (part.substring(0, eq) === "upload_id") {
|
| 129 |
+
return decodeURIComponent(part.substring(eq + 1));
|
| 130 |
+
}
|
| 131 |
+
}
|
| 132 |
+
return null;
|
| 133 |
+
}
|
`/Agents/influencer-thread-pipeline/.venv/Lib/site-packages/gradio/templates/node/build/server/chunks/0-CSL1qC8W.js
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { n as n$1 } from './environment-nLIoW9uA.js';
|
| 2 |
+
import { r as redirect } from './index-DKsxGdoA.js';
|
| 3 |
+
import './index-DBqjc0Yf.js';
|
| 4 |
+
|
| 5 |
+
function n({url:n}){let{pathname:r,search:i}=n;n$1&&n.pathname.startsWith(`/theme`)&&redirect(308,`http://127.0.0.1:7860${r}${i}`);}
|
| 6 |
+
|
| 7 |
+
var _layout_server_ts = /*#__PURE__*/Object.freeze({
|
| 8 |
+
__proto__: null,
|
| 9 |
+
load: n
|
| 10 |
+
});
|
| 11 |
+
|
| 12 |
+
const index = 0;
|
| 13 |
+
let component_cache;
|
| 14 |
+
const component = async () => component_cache ??= (await import('./_layout.svelte-wsN35Xyi.js')).default;
|
| 15 |
+
const server_id = "src/routes/+layout.server.ts";
|
| 16 |
+
const imports = ["_app/immutable/nodes/0.BzIpv2qh.js","_app/immutable/chunks/DZH2DxBD.js","_app/immutable/chunks/CnXt9nDf.js"];
|
| 17 |
+
const stylesheets = ["_app/immutable/assets/0.DSNh2M0f.css"];
|
| 18 |
+
const fonts = [];
|
| 19 |
+
|
| 20 |
+
export { component, fonts, imports, index, _layout_server_ts as server, server_id, stylesheets };
|
| 21 |
+
//# sourceMappingURL=0-CSL1qC8W.js.map
|
`/Agents/influencer-thread-pipeline/.venv/Lib/site-packages/gradio/templates/node/build/server/chunks/1-Dbm9L0GN.js
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
const index = 1;
|
| 2 |
+
let component_cache;
|
| 3 |
+
const component = async () => component_cache ??= (await import('./error.svelte-BacYMNT2.js')).default;
|
| 4 |
+
const imports = ["_app/immutable/nodes/1.CakXDPfs.js","_app/immutable/chunks/DZH2DxBD.js","_app/immutable/chunks/DbkLaIOm.js","_app/immutable/chunks/C2u59Ty-.js","_app/immutable/chunks/DO4jZ8-K.js","_app/immutable/chunks/CnXt9nDf.js"];
|
| 5 |
+
const stylesheets = [];
|
| 6 |
+
const fonts = [];
|
| 7 |
+
|
| 8 |
+
export { component, fonts, imports, index, stylesheets };
|
| 9 |
+
//# sourceMappingURL=1-Dbm9L0GN.js.map
|
`/Agents/influencer-thread-pipeline/.venv/Lib/site-packages/gradio/templates/node/build/server/chunks/2-CQ_Bz8hd.js
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
`/Agents/influencer-thread-pipeline/.venv/Lib/site-packages/gradio/templates/node/build/server/chunks/Example10-8GKOSZX2.js
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import './async-Cv1-GZGV.js';
|
| 2 |
+
import { b as attr_style, i as stringify, a as attr_class } from './renderer-Dic3PuWn.js';
|
| 3 |
+
|
| 4 |
+
function t(t,n){let{value:r,type:i,selected:a=false}=n;t.push(`<div${attr_style(`background-color: ${stringify(r||`black`)}`)}${attr_class(`svelte-1k1s8qu`,void 0,{table:i===`table`,gallery:i===`gallery`,selected:a})}></div>`);}
|
| 5 |
+
|
| 6 |
+
export { t as default };
|
| 7 |
+
//# sourceMappingURL=Example10-8GKOSZX2.js.map
|
`/Agents/influencer-thread-pipeline/.venv/Lib/site-packages/gradio/templates/node/build/server/chunks/Example12-xQwKGIj7.js
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import './async-Cv1-GZGV.js';
|
| 2 |
+
import { a as attr_class, e as escape_html } from './renderer-Dic3PuWn.js';
|
| 3 |
+
|
| 4 |
+
function t(t,n){t.component(t=>{let{value:r,type:i,selected:a=false,choices:o}=n,s=(r?Array.isArray(r)?r:[r]:[]).map(e=>o.find(t=>t[1]===e)?.[0]).filter(e=>e!==void 0).join(`, `);t.push(`<div${attr_class(`svelte-1by696e`,void 0,{table:i===`table`,gallery:i===`gallery`,selected:a})}>${escape_html(s)}</div>`);});}
|
| 5 |
+
|
| 6 |
+
export { t as default };
|
| 7 |
+
//# sourceMappingURL=Example12-xQwKGIj7.js.map
|
`/Agents/influencer-thread-pipeline/.venv/Lib/site-packages/gradio/templates/node/build/server/chunks/Example14-BDt9lUCk.js
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import './async-Cv1-GZGV.js';
|
| 2 |
+
import { a as attr_class, e as escape_html, h as ensure_array_like, d as derived } from './renderer-Dic3PuWn.js';
|
| 3 |
+
|
| 4 |
+
function t(t,n){t.component(t=>{let{value:r,type:i,selected:a=false,index:o}=n,s=derived(()=>Array.isArray(r)),c=derived(()=>s()&&(r.length===0||r[0].length===0));if(s()){if(t.push(`<!--[0-->`),t.push(`<div${attr_class(`svelte-wcwkqi`,void 0,{table:i===`table`,gallery:i===`gallery`,selected:a})}>`),typeof r==`string`)t.push(`<!--[0-->`),t.push(`${escape_html(r)}`);else if(c())t.push(`<!--[1-->`),t.push(`<table class="svelte-wcwkqi"><tbody><tr class="svelte-wcwkqi"><td class="svelte-wcwkqi">Empty</td></tr></tbody></table>`);else {t.push(`<!--[-1-->`),t.push(`<table class="svelte-wcwkqi"><tbody><!--[-->`);let n=ensure_array_like(r.slice(0,3));for(let r=0,i=n.length;r<i;r++){let i=n[r];t.push(`<tr class="svelte-wcwkqi"><!--[-->`);let a=ensure_array_like(i.slice(0,3));for(let n=0,r=a.length;n<r;n++){let r=a[n];t.push(`<td class="svelte-wcwkqi">${escape_html(r)}</td>`);}t.push(`<!--]-->`),i.length>3?(t.push(`<!--[0-->`),t.push(`<td class="svelte-wcwkqi">…</td>`)):t.push(`<!--[-1-->`),t.push(`<!--]--></tr>`);}t.push(`<!--]--></tbody></table> `),r.length>3?(t.push(`<!--[0-->`),t.push(`<div${attr_class(`overlay svelte-wcwkqi`,void 0,{odd:o%2!=0,even:o%2==0,button:i===`gallery`})}></div>`)):t.push(`<!--[-1-->`),t.push(`<!--]-->`);}t.push(`<!--]--></div>`);}else t.push(`<!--[-1-->`);t.push(`<!--]-->`);});}
|
| 5 |
+
|
| 6 |
+
export { t as default };
|
| 7 |
+
//# sourceMappingURL=Example14-BDt9lUCk.js.map
|
`/Agents/influencer-thread-pipeline/.venv/Lib/site-packages/gradio/templates/node/build/server/chunks/Example15-DOVMOMFU.js
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import './async-Cv1-GZGV.js';
|
| 2 |
+
import { e as escape_html } from './renderer-Dic3PuWn.js';
|
| 3 |
+
|
| 4 |
+
function t(t,n){let{value:r}=n;t.push(`<!---->${escape_html(r||``)}`);}
|
| 5 |
+
|
| 6 |
+
export { t as default };
|
| 7 |
+
//# sourceMappingURL=Example15-DOVMOMFU.js.map
|
`/Agents/influencer-thread-pipeline/.venv/Lib/site-packages/gradio/templates/node/build/server/chunks/Example18-B-up1lL9.js
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import './async-Cv1-GZGV.js';
|
| 2 |
+
import { a as attr_class, e as escape_html } from './renderer-Dic3PuWn.js';
|
| 3 |
+
|
| 4 |
+
function t(t,n){let{value:r,type:i,selected:a=false}=n;t.push(`<div${attr_class(`svelte-1r9rmof`,void 0,{table:i===`table`,gallery:i===`gallery`,selected:a})}>${escape_html(r)}</div>`);}
|
| 5 |
+
|
| 6 |
+
export { t as default };
|
| 7 |
+
//# sourceMappingURL=Example18-B-up1lL9.js.map
|
`/Agents/influencer-thread-pipeline/.venv/Lib/site-packages/gradio/templates/node/build/server/chunks/Example19-C8Rd0OgD.js
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import './async-Cv1-GZGV.js';
|
| 2 |
+
import { a as attr_class, e as escape_html } from './renderer-Dic3PuWn.js';
|
| 3 |
+
|
| 4 |
+
function t(t,n){let{value:r,type:i,selected:a=false}=n;t.push(`<div${attr_class(`svelte-1eh6nev`,void 0,{table:i===`table`,gallery:i===`gallery`,selected:a})}>${escape_html(r)}</div>`);}
|
| 5 |
+
|
| 6 |
+
export { t as default };
|
| 7 |
+
//# sourceMappingURL=Example19-C8Rd0OgD.js.map
|
`/Agents/influencer-thread-pipeline/.venv/Lib/site-packages/gradio/templates/node/build/server/chunks/Example2-70VzHOK1.js
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { a as attr_class, e as escape_html } from './renderer-Dic3PuWn.js';
|
| 2 |
+
import './async-Cv1-GZGV.js';
|
| 3 |
+
|
| 4 |
+
function n(n,r){n.component(n=>{let{value:i,type:a,selected:o=false}=r;function s(e,t=60){if(!e)return ``;let n=String(e);return n.length<=t?n:n.slice(0,t)+`...`}n.push(`<div${attr_class(`svelte-xxobeb`,void 0,{table:a===`table`,gallery:a===`gallery`,selected:o})}>${escape_html(s(i))}</div>`);});}
|
| 5 |
+
|
| 6 |
+
export { n as default };
|
| 7 |
+
//# sourceMappingURL=Example2-70VzHOK1.js.map
|
`/Agents/influencer-thread-pipeline/.venv/Lib/site-packages/gradio/templates/node/build/server/chunks/Example21-DCmcGVAD.js
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import './async-Cv1-GZGV.js';
|
| 2 |
+
import { a as attr_class, e as escape_html } from './renderer-Dic3PuWn.js';
|
| 3 |
+
|
| 4 |
+
function t(t,n){t.component(t=>{let{value:r,type:i,selected:a=false}=n;t.push(`<div${attr_class(`svelte-1p04unr`,void 0,{table:i===`table`,gallery:i===`gallery`,selected:a})}>${escape_html(r?Array.isArray(r)?r.join(`, `):r:``)}</div>`);});}
|
| 5 |
+
|
| 6 |
+
export { t as default };
|
| 7 |
+
//# sourceMappingURL=Example21-DCmcGVAD.js.map
|