Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix isssue with running with nginx #4133

Merged
merged 12 commits into from
May 10, 2023
Merged

Fix isssue with running with nginx #4133

merged 12 commits into from
May 10, 2023

Conversation

abidlabs
Copy link
Member

@abidlabs abidlabs commented May 9, 2023

Fixes: #3472 by adding a root_path parameter to launch() which should be set to the same as the subpath of the nginx reverse proxy. I looked pretty hard to see if there was a way that we didn't have to manually specify this parameter but it seems that FastAPI apps (or any web apps) have no way of knowing what the path of the proxy is so this needs to be manually specified: https://fastapi.tiangolo.com/advanced/behind-a-proxy/#setting-the-root_path-in-the-fastapi-app

Hard to write a test for this, but I replicate the nginx conf & test code from this comment: #3472 (comment)

And you can see it running successfully here: http://54.191.13.1/app/gradio/

@gradio-pr-bot
Copy link
Collaborator

All the demos for this PR have been deployed at https://huggingface.co/spaces/gradio-pr-deploys/pr-4133-all-demos

@abidlabs abidlabs changed the title nginx-root Fix isssue with running with nginx May 10, 2023
@abidlabs abidlabs marked this pull request as ready for review May 10, 2023 06:00
zuazo added a commit to zuazo-forks/gradio that referenced this pull request May 10, 2023
gradio/routes.py Outdated
@@ -222,15 +223,17 @@ def login(form_data: OAuth2PasswordRequestForm = Depends()):
def main(request: fastapi.Request, user: str = Depends(get_current_user)):
mimetypes.add_type("application/javascript", ".js")
blocks = app.get_blocks()
root_path = request.scope.get("root_path")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@abidlabs Thanks for the fix! If we're reading the root_path from the request, why do we need an argument in blocks?

Copy link
Member Author

@abidlabs abidlabs May 10, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good question. The root_path from the request will include the subpath if you mount Gradio within a FastAPI app. However, it will not include any subpath that comes from the nginx reverse proxy since the FastAPI app does not know about that. So you need to have both

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

where is the Blocks.root_path used? I only see the root_path from the request being used.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In configure_app. The FastAPI's app's root_path is set to Blocks's root_path

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When you do request.scope.get("root_path"), it combines both the FastAPI app's explicit root path (the same one coming from the nginx reverse proxy), along with any subpath that your app may have because it's mounted within a larger FastAPI

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am planning on writing a Guide that explains this more (#3260). But for now, yes you need both

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Take a look at this user's 2 examples to see why you need both: #3472 (comment)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see it being set to self.root_path but never being used, is that something the FastAPI app automatically recognizes?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup the root_path is used internally by request.scope.get("root_path"). This is kinda mentioned here: https://fastapi.tiangolo.com/advanced/behind-a-proxy/#setting-the-root_path-in-the-fastapi-app

gradio/routes.py Outdated Show resolved Hide resolved
gradio/routes.py Outdated Show resolved Hide resolved
gradio/routes.py Outdated
@@ -222,15 +223,17 @@ def login(form_data: OAuth2PasswordRequestForm = Depends()):
def main(request: fastapi.Request, user: str = Depends(get_current_user)):
mimetypes.add_type("application/javascript", ".js")
blocks = app.get_blocks()
root_path = request.scope.get("root_path")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

where is the Blocks.root_path used? I only see the root_path from the request being used.

abidlabs and others added 2 commits May 10, 2023 13:30
Co-authored-by: aliabid94 <[email protected]>
Co-authored-by: aliabid94 <[email protected]>
@aliabid94
Copy link
Collaborator

aliabid94 commented May 10, 2023

Looking at where we use root in the frontend:

File requests, in normalise_file

export function normalise_file(
	file: Array<FileData> | FileData | string | null,
	root: string,
	root_url: string | null
): Array<FileData> | FileData | null {
  // ...     
	if (file.is_file) {
		if (root_url == null) {
			file.data = root + "/file=" + file.name;
		} else {
			file.data = "/proxy=" + root_url + "/file=" + file.name;
		}
	}
	return file;
}

a) root will never end in slash, correct?
b) can we get rid of root_url? If not, can you explain where that's used real quick

Loading theme / stylesheets

		await mount_css(config.root + "/theme.css", document.head);

Looks fine.

API Docs

	if (root === "") {
		root = location.protocol + "//" + location.host + location.pathname;
	}
	if (!root.endsWith("/")) {
		root += "/";
	}
        
// ...
	let response = await fetch(root + "info");

// ...
		let [response, status_code] = await post_data(
			`${root}run/${dependency.api_name}`,
			{
				data: inputs
			}
		);

EDIT: We can leave API docs as is for now, and clean it up another PR

@abidlabs
Copy link
Member Author

abidlabs commented May 10, 2023

a) root will never end in slash, correct?

It shouldn't as long as the user sets it up correctly. Here's what I say in the docstring for root_path:

The root path (or "mount point") of the application, if it's not served from the root ("/") of the domain. Often used when the application is behind a reverse proxy that forwards requests to the application. For example, if the application is served at "https://example.com/myapp", the root_path should be set to "/myapp".

We could check for a trailing slash and remove it just in case

b) can we get rid of root_url? If not, can you explain where that's used real quick

Nope we need root_url because that's used in place of root when a Gradio app is loaded from an external source like Spaces using gr.load(). All files, etc. should use the root_url of the Space (since that's where they'd be generated and stored), not the root_url of the current Space.

We could rename root_url to be remote_url to be more clear. But let's do that later as this field appears in the config and I don't want to break anything with loading external Spaces, etc.

Copy link
Collaborator

@aliabid94 aliabid94 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok LGTM

@abidlabs
Copy link
Member Author

a) root will never end in slash, correct?

I just checked and even if a user does put the additional trailing slash, FastAPI removes it, so we should be good.

It looks like all questions have been answered so I'll go ahead and merge! Thanks @aliabid94 @freddyaboulton for the detailed review.

@abidlabs abidlabs merged commit 2cf13a1 into main May 10, 2023
@abidlabs abidlabs deleted the nginx-root branch May 10, 2023 19:36
dawoodkhan82 pushed a commit that referenced this pull request Jun 2, 2023
* nginx-root

* fix

* ability to set root path

* removed root

* removed root

* fix

* changelog

* Update gradio/routes.py

Co-authored-by: aliabid94 <[email protected]>

* Update gradio/routes.py

Co-authored-by: aliabid94 <[email protected]>

---------

Co-authored-by: aliabid94 <[email protected]>
dawoodkhan82 added a commit that referenced this pull request Jun 11, 2023
* Add min max handling for Number (#3871)

* feat: add min max handling for Number

* Update CHANGELOG.md

* fix: Error when min or max is not specified

* fix formatting

* fix: error when nothing is specified

* Just put infinity in min and max

---------

Co-authored-by: Dawood Khan <[email protected]>

* number limit

* Update gradio/components.py

Co-authored-by: Abubakar Abid <[email protected]>

* New Version Docs (#4027)

* [create-pull-request] automated change

* Trigger Build

---------

Co-authored-by: aliabd <[email protected]>
Co-authored-by: aliabd <[email protected]>

* Safer `HuggingFaceDatasetSaver` (and deprecate `HuggingFaceDatasetJsonSaver`) (#3973)

* Draft for a safer HuggingFaceDatasetSaver

* Rename (and replace) gr.SaferHuggingFaceDatasetSaver as gr.HuggingFaceDatasetSaver

* update changelog

* ruff

* doc

* tmp work

* merge 2 classes

* remove useless code

* adapt tests

* Update gradio/flagging.py

Co-authored-by: Abubakar Abid <[email protected]>

* Update CHANGELOG.md

* fix typing

* code formatting

* removed print from tests

* removing imports

* removing imports

* fix paths

* formatting

* wording

* formating

* fix tests

---------

Co-authored-by: testbot <[email protected]>
Co-authored-by: Abubakar Abid <[email protected]>

* merge

* Allow state to be rendered multiple times (#4030)

* state render

* add test

* formatting

* changelog

* Allow decoding b64 string without header in processing utils (#4031)

* allow decoding b64 string without headers

* install gradio-client in edittable mode

* update GH actions

* add test for decoding headerless b64

* add test for decoding headerless b64 image

* some linting

* fix test

---------

Co-authored-by: Abubakar Abid <[email protected]>

* Sets matplotlib backend to agg before rendering math (#4029)

* matplotlib-agg

* fix

* context manager

* Update CHANGELOG.md

* update demos

* linting

* removed warning

* fix test

* fixes

* fix tests

* Upgrade pyright to 1.1.305 (#4042)

* Fastapi Python Client Guide (#3892)

* fastapi guide

* changelog

* writing

* finish guide

* fix

* Update guides/06_client-libraries/fastapi-app-with-the-gradio-client.md

Co-authored-by: Ali Abdalla <[email protected]>

* Update guides/06_client-libraries/fastapi-app-with-the-gradio-client.md

Co-authored-by: Ali Abdalla <[email protected]>

* Update guides/06_client-libraries/fastapi-app-with-the-gradio-client.md

Co-authored-by: Ali Abdalla <[email protected]>

* Update guides/06_client-libraries/fastapi-app-with-the-gradio-client.md

Co-authored-by: Ali Abdalla <[email protected]>

* dependencies

* html

---------

Co-authored-by: Ali Abdalla <[email protected]>

* fix overflowing gutter and dark mode base color (#4051)

* Add ability to blocklist filepaths, ability to specify where gradio temp files are created (#4047)

* temporary file

* tests

* formatting

* rename

* added another test

* guide

* formatting

* changelog

* added custom gradio temp directory (#4053)

* added custom gradio temp directory

* Update 03_sharing-your-app.md

* rename test

* address review

* remove print

* Chatbot code syntax highlighting (#4048)

* first pass

* fixes

* more fixes

* remove breaks

* format

* version

* pr fixes

* changelog

* test fix

* background color

* format

* revert test fix

* changes

* changes

* test

* changes

* changes

* changes

* changes

* changes

---------

Co-authored-by: Abubakar Abid <[email protected]>
Co-authored-by: Ali Abid <[email protected]>

* Fixes issue with indentation in code field with streaming (#4043)

* indent fix

* fix

* changelog

* fix overflowing gutter and dark mode base color (#4051)

* Add ability to blocklist filepaths, ability to specify where gradio temp files are created (#4047)

* temporary file

* tests

* formatting

* rename

* added another test

* guide

* formatting

* changelog

* added custom gradio temp directory (#4053)

* added custom gradio temp directory

* Update 03_sharing-your-app.md

* rename test

* address review

* remove print

* Chatbot code syntax highlighting (#4048)

* first pass

* fixes

* more fixes

* remove breaks

* format

* version

* pr fixes

* changelog

* test fix

* background color

* format

* revert test fix

* changes

* changes

* test

* changes

* changes

* changes

* changes

* changes

---------

Co-authored-by: Abubakar Abid <[email protected]>
Co-authored-by: Ali Abid <[email protected]>

* fix

* fix test

---------

Co-authored-by: Abubakar Abid <[email protected]>
Co-authored-by: pngwn <[email protected]>
Co-authored-by: Ali Abid <[email protected]>

* [create-pull-request] automated change (#4059)

Co-authored-by: aliabid94 <[email protected]>
Co-authored-by: Abubakar Abid <[email protected]>

* changelog (#4064)

* New Version Docs (#4069)

* [create-pull-request] automated change

* Trigger Build

---------

Co-authored-by: aliabd <[email protected]>
Co-authored-by: aliabd <[email protected]>

* Soft theme fix (#4070)

* fix

* fix

---------

Co-authored-by: Abubakar Abid <[email protected]>

* Empty gallery fix (#4072)

* changes

* changes

---------

Co-authored-by: Abubakar Abid <[email protected]>

* Fix bug where functions with type hints caused errors (#4068)

* Fix + test

* CHANGELOG

* Update test/test_utils.py

Co-authored-by: Abubakar Abid <[email protected]>

* Update gradio/utils.py

Co-authored-by: Abubakar Abid <[email protected]>

---------

Co-authored-by: Abubakar Abid <[email protected]>

* More Ruff rules (#4038)

* Bump ruff to 0.0.264

* Enable Ruff Naming rules and fix most errors

* Move `clean_html` to utils (to fix an N lint error)

* Changelog

* Clean up possibly leaking file handles

* Enable and autofix Ruff SIM

* Fix remaining Ruff SIMs

* Enable and autofix Ruff UP issues

* Fix misordered import from #4048

* Fix bare except from #4048

---------

Co-authored-by: Abubakar Abid <[email protected]>

* [WIP] Language Agnostic Typing in `/info` route (#4039)

* First commit

* All serializers

* Remove output type

* Add route

* Format json

* Modify dropdown and slider choices

* Fix impl

* Lint

* Add tests

* Fix lint

* remove breakpoint

* Tests passing locally

* Format code

* Address comments

* Use union + fix tests

* handle multiple file case

* Add serializer to info payload

* lint

* Add to CHANGELOG

* grc version

* requirements

* fix test

---------

Co-authored-by: Abubakar Abid <[email protected]>

* Keep hidden Accordion content in DOM (#4073)

* changes

* changes

---------

Co-authored-by: Abubakar Abid <[email protected]>

* Theme builder fixes (#4080)

* theme-builder-fixes

* theme-builder-fixes

* fix expand issue

* changes

* Update gradio/themes/builder_app.py

* changelog

---------

Co-authored-by: Ali Abid <[email protected]>

* Misc file and docs fixes (#4086)

* uvicorn version

* uvicorn version

* changes

* guides

* guide

* changelog

* typo

* typo

* Update guides/04_integrating-other-frameworks/01_using-hugging-face-integrations.md

* chinese lang

* rename

* Update guides/04_integrating-other-frameworks/01_using-hugging-face-integrations.md

* Update guides/03_building-with-blocks/04_custom-CSS-and-JS.md

Co-authored-by: aliabid94 <[email protected]>

* address review

* simplify section

---------

Co-authored-by: aliabid94 <[email protected]>

* Removing "State" from view API info (#4107)

* wip pr

* update client version

* update space fetcher

* changelog, workflow

* fix not flaky tests

* lint

* v2

* Dont send request to `/info` if version before 3.28.3 (#4109)

* Add code

* Lint

* CHANGELOG

---------

Co-authored-by: Abubakar Abid <[email protected]>

* Upload audio ios (#4071)

* changes

* changes

* change

* changes

* changes

* changes

---------

Co-authored-by: Abubakar Abid <[email protected]>

* Allow textbox / number submits to trigger Interface submit (#4090)

* changes

* changes

* changes

* changes

* changes

---------

Co-authored-by: Abubakar Abid <[email protected]>

* Fix slider released event not triggering when released on mobile (#4098)

* Fix slider released event not triggering when released on mobile

* Update CHANGELOG

* fix range test

* retrigger

---------

Co-authored-by: Abubakar Abid <[email protected]>

* Fix then logic to work after failures (#4115)

* change

* changes

* changes

---------

Co-authored-by: Abubakar Abid <[email protected]>

* Fixes to view API page (#4112)

* logo

* fix for new info and logo path

* changelog

* remove example_input from returns

---------

Co-authored-by: Ali Abdalla <[email protected]>

* Add support for async generators (#3821)

* Add impl + unit test

* CHANGELOG

* Lint

* Type check

* Remove print

* Fix tests

* revert change

* Lint

* formatting

* Fix test

* Lint

---------

Co-authored-by: Abubakar Abid <[email protected]>
Co-authored-by: Ali Abid <[email protected]>

* release (#4116)

* Bumpt client version (#4125)

* New Version Docs (#4131)

* [create-pull-request] automated change

* Trigger Build

---------

Co-authored-by: aliabd <[email protected]>
Co-authored-by: aliabd <[email protected]>

* Fix create version docs action (#4130)

* define version instead of upgrading

* add sleep

---------

Co-authored-by: Abubakar Abid <[email protected]>

* Fix dev docs (#4132)

* Move .config/README.md to js/README.md

* Link js/README.md from CONTRIBUTING.md

* Update CHANGELOG.md

---------

Co-authored-by: Abubakar Abid <[email protected]>

* changelog (#4136)

* Fix website build issue (#4142)

* upgrade pnpm

* changelgo

* Fix python client test (#4138)

* Fix python client test

* CHANGELOG

---------

Co-authored-by: Abubakar Abid <[email protected]>

* Fix isssue with running with nginx (#4133)

* nginx-root

* fix

* ability to set root path

* removed root

* removed root

* fix

* changelog

* Update gradio/routes.py

Co-authored-by: aliabid94 <[email protected]>

* Update gradio/routes.py

Co-authored-by: aliabid94 <[email protected]>

---------

Co-authored-by: aliabid94 <[email protected]>

* Record username when flagging (#4135)

* record username

* fix

* changelog fix

* format

* fix hf saver

* fix deserialization

* fixes

* Fix api info for File component (#4153)

* Fix output file type info

* Fix example inputs

* CHANGELOG

* Update client

* Add test

* Bump version

* Bump min client version

* Update .prettierignore adding client/js/dist and .venv (#4160)

* Fix the prettier.ignorePath field in the VSCode workspace settings (#4164)

Co-authored-by: pngwn <[email protected]>

* simplify format of changelog (#4163)

* Fix the wildcard in .editorconfig to match files in nested directories (#4165)

* Fix the wildcard in .editorconfig to match files in nested directories

* Remove a wrong whitespace in a brace expansion notation in .editorconfig

---------

Co-authored-by: pngwn <[email protected]>

* Fix flaky interface test (#4168)

* Fix test

* Lint

* Fix vs code lint

* Adds missing components to gradio client serializing's component mapping (#4167)

* add missing serialization

* format

* update release note format

* update release note format

* fix test

* Release 3.30 (#4166)

* release

* requirements

* [Docs] Resolve numerous typos (#4170)

* Resolve numerous typos

* Delete test.py

* Run generate_notebooks

* notebooks

---------

Co-authored-by: Abubakar Abid <[email protected]>

* New Version Docs (#4172)

* [create-pull-request] automated change

* Update v3.30.0_template.html

---------

Co-authored-by: abidlabs <[email protected]>
Co-authored-by: Abubakar Abid <[email protected]>

* Dispatch dropdown change on value change for any reason (#4128)

* changes

* changes

* changes

---------

Co-authored-by: Abubakar Abid <[email protected]>

* hotfix for test (#4173)

* hotfix for test

* removed comment

* 3712 js client (#3899)

* update ci (#4184)

* bump client version (#4185)

* bump client version

* ignore spaces-test

* Fix (#4186)

* bump client version

* ignore spaces-test

* fix

* update token for npm action (#4187)

* change (#4189)

* ci typo (#4190)

* Fix npm publish again again (#4191)

* ci typo

* fix

* Fix npm publish again again (#4192)

* ci typo

* fix

* again

* Fix npm publish again again (#4193)

* ci typo

* fix

* again

* again

* Add format argument to Audio (#4178)

* experimental

* Add test

* Rename to format

* Rename

* CHANGELOG

* Add to docstring

* Update gradio/components.py

Co-authored-by: Abubakar Abid <[email protected]>

---------

Co-authored-by: Abubakar Abid <[email protected]>

* chore: update versions (#4188)

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

* Fix npm publish again again (#4195)

* ci typo

* fix

* again

* again

* again

* client docs tweaks (#4196)

* ci typo

* fix

* again

* again

* again

* ignore workbench

* small tweaks for publish + docs

* Fix "TypeError: issubclass() arg 1 must be a class" When Optional args  (#4200)

* fix "issubclass() arg 1 must be a class" when args is Optional

* Update CHANGELOG.md

add fix "TypeError: issubclass() arg 1 must be a class" when use Optional args

* Update gradio/helpers.py

Co-authored-by: Aarni Koskela <[email protected]>

* changelog

* formatting

---------

Co-authored-by: Abubakar Abid <[email protected]>
Co-authored-by: Aarni Koskela <[email protected]>

* Fix semiver import (#4201)

* fix token (#4208)

* fix token

* add label

* Fix Explanation Regarding NumPy Image Component (#4204)

* 20230513 swap np height and width in docs

* changelog

---------

Co-authored-by: Abubakar Abid <[email protected]>

* Correct stacklevel for check_deprecated_parameters (#4203)

Co-authored-by: Abubakar Abid <[email protected]>

* Programmatically launch reload to allow factories and arguments to be passed to the app (#4119)

* Programmatically lauch reload to allow factories and arguments to be passed to the app

* add warning

* modify warning

* guide fixes

* formatting

* changes

* warning

* import fix

* fix tests

* fix tests

---------

Co-authored-by: Abubakar Abid <[email protected]>

* Update CONTRIBUTING.md (#4220)

* Input listener (#4157)

* changes

* changes

* changes

* changes

* changes

* changes

* changes

* chnages

* fix

* changes

* changes

* merge

* changes

* restore

---------

Co-authored-by: Abubakar Abid <[email protected]>

* Do not do any analytics requests if analytics are disabled (#4194)

* Move analytics-related bits to gradio.analytics

* Do not do any analytics requests if analytics are disabled

* Remove unused log_feature_analytics

* removed redundant analytics, rewrote

* renamed

* save

* fixed test'

---------

Co-authored-by: Abubakar Abid <[email protected]>

* Increase websocket messaging timeout (#4235)

* increase websocket timeout

* changelog

* Fix for `typing.get_type_hints()` on Python 3.9 or lower (#4228)

* fix

* fix docstring

* type hint fix

* fix test

* Update gradio/utils.py

Co-authored-by: Aarni Koskela <[email protected]>

* fix indentation

---------

Co-authored-by: Aarni Koskela <[email protected]>

* Some tweaks to the Client (#4230)

* parameter names

* tweaks

* separate out serialize

* fix

* changelog

* fix

* fix

* improve test

* Only allow messaging update if analytics is enabled (#4236)

* Only allow messaging update if analytics are allowed

Follows up on #4194

* Remove duplicate changelog entry

* remove circular import

---------

Co-authored-by: Abubakar Abid <[email protected]>

* Fix client filepaths (#4202)

* transform returned paths to useful URLs

* changeset

* update app

* revert

* revert

* changelog

* Update client/js/src/client.ts

Co-authored-by: aliabid94 <[email protected]>

* format

---------

Co-authored-by: Abubakar Abid <[email protected]>
Co-authored-by: aliabid94 <[email protected]>

* fix cancels (#4225)

* fix cancels

* changelog

* refactor to make it work

* chore: update versions (#4207)

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

* Fix publish (#4240)

* fix npm publish

* fix npm publish

* release (#4219)

Co-authored-by: pngwn <[email protected]>

* Fixes chatbot_dialogpt demo (#4238)

* demo fix

* changelog

* fix

* demo

---------

Co-authored-by: Abubakar Abid <[email protected]>

* Fix JSONDecodeError (#4241)

* Fix JSONDecodeError bug (#4237)

* Remove unused import

* Clean up code

* Fix JSONDecodeError (#4241)

* Accept all Exceptions

---------

Co-authored-by: Abubakar Abid <[email protected]>

* make workbench private (#4247)

* Refactoring (#4223)

* Replace var with const in js/app/src/main.ts

* Remove unnecessary nullish coalescing in js/app/src/main.ts

* Remove unnecessary white spaces in the NPM scripts in js/app/package.json

* Use object key-value shorthand

* changelog

---------

Co-authored-by: pngwn <[email protected]>

* Move mount_css() from main.ts to css.ts (#4222)

* Move mount_css() from main.ts to css.ts because these is a circular dependency between main.ts and Index.svelte (and it will help the development of the Wasm ver in the future)

* changelog

---------

Co-authored-by: pngwn <[email protected]>

* [create-pull-request] automated change (#4250)

Co-authored-by: aliabd <[email protected]>

* Fix run on click (#4258)

* fix run on click

* changelog

* Upgrade black to 23.3 (#4259)

* Upgrade black

* Conservatively upgrade packaging too since it's black's dependency

* Using marked for chatbot markdown parsing (#4150)

* fix info request in js client (#4271)

* fix info request in js client

* changelog

* Temp file fixes (#4256)

* Fix bug

* Linting

* CHANGELOG

* Add tests

* Update test

* Fix remaining components + add tests

* Fix tests

* Fix tests

* Address comments

* Ensure error modal display as expected when using the queue (#4273)

* Allow passing FastAPI app options (#4282)

* App: don't force docs_url and redoc_url to None

* App.create_app: allow passing in app_kwargs

* start_server + launch: allow passing in app_kwargs

* Changelog

* Apply suggestions from code review

Co-authored-by: Abubakar Abid <[email protected]>

* Use .launch for tests

---------

Co-authored-by: Abubakar Abid <[email protected]>

* Katex support in chatbot (#4285)

* katex

* katex support

* changelog

* fixes

* pr fixes

---------

Co-authored-by: Abubakar Abid <[email protected]>

* Release 3.32.0 (#4293)

* release 3.32.0

* changelog

* New Version Docs (#4296)

* [create-pull-request] automated change

* Update v3.32.0_template.html

---------

Co-authored-by: abidlabs <[email protected]>
Co-authored-by: Abubakar Abid <[email protected]>

* Add overridden type annotations on `normalise_file()` to remove @TS-i… (#4315)

* Add overridden type annotations on `normalise_file()` to remove @ts-ignore, and remove its unnecessary export

* changeset

---------

Co-authored-by: pngwn <[email protected]>

* typo (minor): extra newline puts the documentation of colums to grid (#4337)

* typo (minor): extra newline puts the documentation of colums to grid

* edited changelog

* changelog

---------

Co-authored-by: thiswillbeyourgithub <[email protected]>
Co-authored-by: Abubakar Abid <[email protected]>

* return a Dependency instance from Blocks.load event listener (#4304)

* return a Dependency instance from Blocks.load event listener

* a test case for chaining then from load event

* update CHANGELOG

* add test for load.then with blocks re-used

* fixes

---------

Co-authored-by: Abubakar Abid <[email protected]>

* Fix typo in client/js/README.md (#4310)

Co-authored-by: Abubakar Abid <[email protected]>

* chore: update versions (#4283)

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

* Optimize frontend's is_dep calls (#4334)

* Optimize is_dep (36 to 12 msec)

* Call is_dep less (12 msec to 9 msec)

* Changelog

---------

Co-authored-by: pngwn <[email protected]>

* various client refactors + tweaks (#4357)

* changeset

* Add a type annotation on the `api` variable to which the return value of `view_config()` is assigned, and update the type annotation and exception handling on `view_config` as well (#4311)

* Remove unnecessary @ts-ignore (#4314)

* Remove unnecessary Promise wrapping another promise (#4313)

* Remove unnecessary Promise wrapping another promise

* Remove an error handeler that may remove detailed error stacks

* changeset

* remove changeset

---------

Co-authored-by: pngwn <[email protected]>

* Stop using `let` for unchanged variables in `client.ts` (#4312)

* Stop using `let` for unchanged variables in `client.ts`

* fixes

---------

Co-authored-by: pngwn <[email protected]>

---------

Co-authored-by: Yuichiro Tachibana (Tsuchiya) <[email protected]>

* Remove a bunch of unused frontend code (#4275)

Co-authored-by: pngwn <[email protected]>

* Respect `interactive=True` in output of `gr.Interface` (#4356)

* tests

* changelog

* lint

* Update gradio/interface.py

Co-authored-by: Aarni Koskela <[email protected]>

* format

---------

Co-authored-by: Aarni Koskela <[email protected]>

* Don't allow dotfiles for /file= route (#4303)

* Don't allow dotfiles or files in "dot directories" for /file=

* update guide

---------

Co-authored-by: Abubakar Abid <[email protected]>

* Push to spaces (#4033)

* changes

* first commit

* Update gradio/upload.py

Co-authored-by: Aarni Koskela <[email protected]>

* Update gradio/upload.py

Co-authored-by: Aarni Koskela <[email protected]>

* changes

* changes

* changes

* changes

* changes

* changes

* changes

* chnages

* changes

* changes

* changes

* changes

* Update 03_sharing-your-app.md

* changes

* changes

* change

* changes

* changes

* changes

* Update gradio/deploy_space.py

Co-authored-by: Abubakar Abid <[email protected]>

* changes

* changes

* changes

---------

Co-authored-by: Aarni Koskela <[email protected]>
Co-authored-by: Abubakar Abid <[email protected]>

* Do not send HF token to other domains via `/proxy` (#4368)

* test

* fix

* changelog

* fix, add warnings

* Make chatbot input fields non-interactive while bot is streaming (#4363)

* Add demo impl

* trigger then if generating

* remove unused value

* CHANGELOG

* Fix code

* Update guide

* Update guides/07_other-tutorials/creating-a-chatbot.md

Co-authored-by: pngwn <[email protected]>

---------

Co-authored-by: pngwn <[email protected]>
Co-authored-by: Abubakar Abid <[email protected]>

* Prevent path traversal in `/file` routes (#4370)

* add tests

* add tests

* file route fix

* update tests

* formatting

* file access

* cleanup

* cleaning

* fix tests

* Favicon fix for Windows (#4369)

* favicon fix

* changelog

* svg

* remove favicon

* actual fix

* Add pypi classifiers to pyproject.toml (#4383)

* Add pypi classifiers to pyproject.toml

* Add OS classifier

---------

Co-authored-by: Freddy Boulton <[email protected]>

* Use DOMPurify to sanitize html in chatbot (#4360)

* dompurify

* changelog

* format

* clean

* changelog

* Update run.py

* update happy-dom

---------

Co-authored-by: pngwn <[email protected]>

* fix copy button invalid & copy button (invisible) duplication bug in chatbot (#4350)

* fix a copy button duplication bug in chatbot

* fix copy button invalid issue

* Update CHANGELOG.md: Fixed Copy Button

* fix changelog typo

* switch to static HTML + event delegation for copy button

* fix

* format + notebooks

* format + notebooks

---------

Co-authored-by: Abubakar Abid <[email protected]>
Co-authored-by: pngwn <[email protected]>

* release 3.33.0 (#4392)

Co-authored-by: aliabid94 <[email protected]>

* Restore offline support (#4398)

* changes

* changes

* changes

* New Version Docs (#4397)

* [create-pull-request] automated change

* Update temporary_template.html

---------

Co-authored-by: abidlabs <[email protected]>
Co-authored-by: Abubakar Abid <[email protected]>

* Fix Base parent in Docs, add Group (#4391)

* fix base parent

* add group to docs

---------

Co-authored-by: Abubakar Abid <[email protected]>

* Remove old versioned docs and fix repo classification  (#4362)

* remove old versioned docs

* delete versioned docs when new one is created

* ignore website dir in linguist calc

* upload and download versioned docs

* modify github action

* remove gitattributes file

---------

Co-authored-by: Abubakar Abid <[email protected]>

* Update message when share link binary is blocked (#4380)

* update share link message

* address suggestion

* changelog

* fix

* formatting

* Update utils.py for validate_url (#4388)

* Update utils.py for validate_url

AWS s3 presigned url cannot work for both HEAD and GET. So when HEAD the presigned url, it will return 403(Forbidden)

* Update gradio/utils.py

* changelog

---------

Co-authored-by: Abubakar Abid <[email protected]>

* v3.33.1 + Guide on setting up Gradio behind nginx... (#4379)

* nginx guide

* delete 3.33.0

* version

* unindent

* Prevent label change event from triggering itself (#4371)

* Fix the Node and pnpm setup actions (#4394)

* Run `pnpm i` with [email protected] to re-generate the lock file (#4393)

* fix indent (#4404)

* Throttle scroll event  (#4158)

* Throttle scroll event

This decreases the amount of function calls when scrolling through the documentation website.

* fix themes base

---------

Co-authored-by: Abubakar Abid <[email protected]>
Co-authored-by: Ali Abdalla <[email protected]>

* merge

* fixes

* changes

* more changes

* notebook

* changelog

* error handle backend

* Update gradio/components.py

Co-authored-by: Abubakar Abid <[email protected]>

* Update gradio/components.py

Co-authored-by: Abubakar Abid <[email protected]>

* Adds `variant` and `interactive` props to `gr.UploadButton` (#4436)

* upload button

* fix index

* changelog

* formatting

* cleanup

* fix  get_continuous_fn bug when having every (#4434)

* fix the bug for wrap continuous func with parameter every while origin func return generator

* Update utils.py

* Update CHANGELOG.md

* Update test_utils.py

* Update CHANGELOG.md

* formatting

---------

Co-authored-by: Abubakar Abid <[email protected]>

* Fix Safari video playback (#4433)

* changes

* changes

---------

Co-authored-by: Abubakar Abid <[email protected]>

* test fix

* test

* tests

* fix ui test

* format

* Increase version gradio-client version/changelog (#4441)

* Increase version gradio-client version/changelog

* req

---------

Co-authored-by: Abubakar Abid <[email protected]>

* fixes

* notebook

* fixed tests finally

* format

* python test fix

* test fix

* remove style from test

* Update CHANGELOG.md

* theme test fix

---------

Co-authored-by: Artemy Egorov <[email protected]>
Co-authored-by: Abubakar Abid <[email protected]>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: aliabd <[email protected]>
Co-authored-by: aliabd <[email protected]>
Co-authored-by: Lucain <[email protected]>
Co-authored-by: testbot <[email protected]>
Co-authored-by: 1lint <[email protected]>
Co-authored-by: Aarni Koskela <[email protected]>
Co-authored-by: pngwn <[email protected]>
Co-authored-by: Ali Abid <[email protected]>
Co-authored-by: aliabid94 <[email protected]>
Co-authored-by: Freddy Boulton <[email protected]>
Co-authored-by: space-nuko <[email protected]>
Co-authored-by: Yuichiro Tachibana (Tsuchiya) <[email protected]>
Co-authored-by: Tom Aarsen <[email protected]>
Co-authored-by: abidlabs <[email protected]>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: LingFeng.Chen.Cn <[email protected]>
Co-authored-by: Der Chien <[email protected]>
Co-authored-by: Micky Brunetti <[email protected]>
Co-authored-by: David Ai <[email protected]>
Co-authored-by: thiswillbeyourgithub <[email protected]>
Co-authored-by: thiswillbeyourgithub <[email protected]>
Co-authored-by: Paul Garner <[email protected]>
Co-authored-by: WilliamRoyNelson <[email protected]>
Co-authored-by: binary-husky <[email protected]>
Co-authored-by: Yan <[email protected]>
Co-authored-by: Shavit <[email protected]>
Co-authored-by: dkjshk <[email protected]>
@meijunfeng2019
Copy link

    location / {
        proxy_pass http://xx.xx.xx.xx:7860;
        proxy_set_header  Host  $host;
    }
   location /theme.css{
       proxy_pass http://xx.xx.xx.xx:7860/app/theme.css;
       proxy_set_header Host $host;
       proxy_set_header X-Real-Ip $remote_addr;
       proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
       proxy_set_header X-Forwarded-Proto $scheme;
   }

加上下面的 location /theme.css可以解决这个问题

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

UI not displaying correctly because of path to theme.css
5 participants