🚀 Get started with your gradio Space!
Your new space has been created, follow these steps to get started (or read the full documentation)
Start by cloning this repo by using:
Use an access token as git password/credential
# When prompted for a password, use an access token with write permissions.
# Generate one from your settings: https://huggingface.co/settings/tokens
git clone https://huggingface.co/spaces/cbensimon/zerogpu-quickstart
Create your gradio app.py file:
import gradio as gr
import spaces
import torch
zero = torch.Tensor([0]).cuda()
print(zero.device) # <-- 'cpu' 🤔
@spaces.GPU
def greet(n):
print(zero.device) # <-- 'cuda:0' 🤗
return f"Hello {zero + n} Tensor"
demo = gr.Interface(fn=greet, inputs=gr.Number(), outputs=gr.Text())
demo.launch()
Then commit and push:
$git add app.py $git commit -m "Add application file" $git push
Finally, your Space should be running on this page after a few moments!
Dependencies
You can add a requirements.txt file at the root of the repository to specify Python dependencies
If needed, you can also add a packages.txt file at the root of the repository to specify Debian dependencies.
The gradio package is pre-installed and its version is set in the sdk_version field in the README.md file.
Personalize your Space
Make your Space stand out by customizing its emoji, colors, and description by editing metadata in its README.md file.
Documentation
Read the full documentation for gradio Spaces here.