2
0
mirror of https://github.com/gradio-app/gradio.git synced 2025-04-24 13:01:18 +08:00

Accept deprecated file route as well ()

* fix

* added docs

* fixes
This commit is contained in:
Abubakar Abid 2022-08-28 14:40:12 -07:00 committed by GitHub
parent 6219dc7b0c
commit 4f0b8f9829
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 23 additions and 2 deletions
gradio
guides
2)building_interfaces
3)building_with_blocks

@ -236,6 +236,10 @@ class App(FastAPI):
f"it is not in any of {app.blocks.temp_dirs}"
)
@app.get("/file/{path:path}", dependencies=[Depends(login_check)])
def file_deprecated(path: str):
return file(path)
async def run_predict(
body: PredictBody, username: str = Depends(get_current_user)
):

@ -25,7 +25,17 @@ $code_gender_sentence_custom_interpretation
## Custom Styling
If you'd like to have more fine-grained control over any aspect of your demo, you can also write your own css or pass in a css file, with the `css` parameter of the `Interface` class.
If you'd like to have more fine-grained control over any aspect of your demo, you can also write your own css or pass in a filepath to a css file, with the `css` parameter of the `Interface` class.
```python
gr.Interface(..., css="body {background-color: red}")
```
If you'd like to reference external files in your css, preface the file path (which can be a relative or absolute path) with `"file="`, for example:
```python
gr.Interface(..., css="body {background-image: url('file=clouds.jpg')}")
```
## Loading Hugging Face Models and Spaces

@ -9,7 +9,14 @@ with gr.Blocks(css="body {background-color: red}") as demo:
...
```
You can also pass the filepath to a CSS file to this argument.
If you'd like to reference external files in your css, preface the file path (which can be a relative or absolute path) with `"file="`, for example:
```python
with gr.Blocks(css="body {background-image: url('file=clouds.jpg')}") as demo:
...
```
You can also pass the filepath to a CSS file to the `css` argument.
## The `elem_id` Argument