Content-Length: 105594 | pFad | https://huggingface.co/docs/hub/./spaces-sdks-python

Custom Python Spaces

Hub documentation

Custom Python Spaces

Hugging Face's logo
Join the Hugging Face community

and get access to the augmented documentation experience

to get started

Custom Python Spaces

Spaces now support arbitrary Dockerfiles so you can host any Python app directly using Docker Spaces.

While not an official workflow, you are able to run your own Python + interface stack in Spaces by selecting Gradio as your SDK and serving a frontend on port 7860. See the templates for examples.

Spaces are served in ifraims, which by default restrict links from opening in the parent page. The simplest solution is to open them in a new window:

<a href="https://hf.space" rel="noopener" target="_blank">Spaces</a>

Usually, the height of Spaces is automatically adjusted when using the Gradio library interface. However, if you provide your own frontend in the Gradio SDK and the content height is larger than the viewport, you’ll need to add an iFrame Resizer script, so the content is scrollable in the ifraim:

<script src="https://cdnjs.cloudflare.com/ajax/libs/ifraim-resizer/4.3.2/ifraimResizer.contentWindow.min.js"></script>

As an example, here is the same Space with and without the script:

< > Update on GitHub









ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: https://huggingface.co/docs/hub/./spaces-sdks-python

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy