ryomo commited on
Commit
9d6bce3
Β·
1 Parent(s): 42e45a9

Implement "Hello World"

Browse files

```
uv init --package
uv add gradio spaces torch
```
...and added a simple app.py.

Files changed (6) hide show
  1. .python-version +1 -0
  2. README.md +1 -1
  3. app.py +14 -0
  4. pyproject.toml +18 -0
  5. src/unpredictable_lord/__init__.py +2 -0
  6. uv.lock +0 -0
.python-version ADDED
@@ -0,0 +1 @@
 
 
1
+ 3.12
README.md CHANGED
@@ -1,6 +1,6 @@
1
  ---
2
  title: Unpredictable Lord
3
- emoji: 🌍
4
  colorFrom: blue
5
  colorTo: pink
6
  sdk: gradio
 
1
  ---
2
  title: Unpredictable Lord
3
+ emoji: πŸ«…
4
  colorFrom: blue
5
  colorTo: pink
6
  sdk: gradio
app.py ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ import spaces
3
+ import torch
4
+
5
+ zero = torch.Tensor([0]).cuda()
6
+ print(zero.device) # <-- 'cpu' πŸ€”
7
+
8
+ @spaces.GPU
9
+ def greet(n):
10
+ print(zero.device) # <-- 'cuda:0' πŸ€—
11
+ return f"Hello {zero + n} Tensor"
12
+
13
+ demo = gr.Interface(fn=greet, inputs=gr.Number(), outputs=gr.Text())
14
+ demo.launch()
pyproject.toml ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [project]
2
+ name = "unpredictable-lord"
3
+ version = "0.1.0"
4
+ description = "Add your description here"
5
+ readme = "README.md"
6
+ requires-python = ">=3.12"
7
+ dependencies = [
8
+ "gradio>=5.49.1",
9
+ "spaces>=0.42.1",
10
+ "torch>=2.9.1",
11
+ ]
12
+
13
+ [project.scripts]
14
+ unpredictable-lord = "unpredictable_lord:main"
15
+
16
+ [build-system]
17
+ requires = ["hatchling"]
18
+ build-backend = "hatchling.build"
src/unpredictable_lord/__init__.py ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ def main() -> None:
2
+ print("Hello from unpredictable-lord!")
uv.lock ADDED
The diff for this file is too large to render. See raw diff