Ava Pun commited on
Commit
bce7f3d
·
1 Parent(s): 368c37f

add spaces.gpu

Browse files
Files changed (3) hide show
  1. app.py +2 -0
  2. pyproject.toml +1 -0
  3. uv.lock +29 -10
app.py CHANGED
@@ -9,6 +9,7 @@ from dataclasses import fields
9
  from urllib.request import urlretrieve
10
 
11
  import gradio as gr
 
12
  import torch.multiprocessing as mp
13
  import transformers
14
  from brickgpt.models import BrickGPT, BrickGPTConfig
@@ -103,6 +104,7 @@ class BrickGenerator:
103
  self.model = model
104
  self.ctx = mp.get_context('spawn')
105
 
 
106
  def generate_bricks(
107
  self,
108
  prompt: str,
 
9
  from urllib.request import urlretrieve
10
 
11
  import gradio as gr
12
+ import spaces
13
  import torch.multiprocessing as mp
14
  import transformers
15
  from brickgpt.models import BrickGPT, BrickGPTConfig
 
104
  self.model = model
105
  self.ctx = mp.get_context('spawn')
106
 
107
+ @spaces.GPU
108
  def generate_bricks(
109
  self,
110
  prompt: str,
pyproject.toml CHANGED
@@ -9,6 +9,7 @@ dependencies = [
9
  "gradio",
10
  "brickgpt",
11
  "torch==2.5.1", # specific version for Hugging Face ZeroGPU
 
12
  ]
13
 
14
  [tool.uv.sources]
 
9
  "gradio",
10
  "brickgpt",
11
  "torch==2.5.1", # specific version for Hugging Face ZeroGPU
12
+ "spaces>=0.37.0",
13
  ]
14
 
15
  [tool.uv.sources]
uv.lock CHANGED
@@ -164,6 +164,7 @@ dependencies = [
164
  { name = "bpy", version = "4.3.0", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.11'" },
165
  { name = "brickgpt" },
166
  { name = "gradio" },
 
167
  { name = "torch" },
168
  ]
169
 
@@ -172,6 +173,7 @@ requires-dist = [
172
  { name = "bpy", specifier = "<=4.3.0" },
173
  { name = "brickgpt", git = "https://github.com/AvaLovelace1/BrickGPT.git" },
174
  { name = "gradio" },
 
175
  { name = "torch", specifier = "==2.5.1" },
176
  ]
177
 
@@ -1085,17 +1087,16 @@ wheels = [
1085
 
1086
  [[package]]
1087
  name = "psutil"
1088
- version = "7.0.0"
1089
  source = { registry = "https://pypi.org/simple" }
1090
- sdist = { url = "https://files.pythonhosted.org/packages/2a/80/336820c1ad9286a4ded7e845b2eccfcb27851ab8ac6abece774a6ff4d3de/psutil-7.0.0.tar.gz", hash = "sha256:7be9c3eba38beccb6495ea33afd982a44074b78f28c434a1f51cc07fd315c456", size = 497003 }
1091
  wheels = [
1092
- { url = "https://files.pythonhosted.org/packages/ed/e6/2d26234410f8b8abdbf891c9da62bee396583f713fb9f3325a4760875d22/psutil-7.0.0-cp36-abi3-macosx_10_9_x86_64.whl", hash = "sha256:101d71dc322e3cffd7cea0650b09b3d08b8e7c4109dd6809fe452dfd00e58b25", size = 238051 },
1093
- { url = "https://files.pythonhosted.org/packages/04/8b/30f930733afe425e3cbfc0e1468a30a18942350c1a8816acfade80c005c4/psutil-7.0.0-cp36-abi3-macosx_11_0_arm64.whl", hash = "sha256:39db632f6bb862eeccf56660871433e111b6ea58f2caea825571951d4b6aa3da", size = 239535 },
1094
- { url = "https://files.pythonhosted.org/packages/2a/ed/d362e84620dd22876b55389248e522338ed1bf134a5edd3b8231d7207f6d/psutil-7.0.0-cp36-abi3-manylinux_2_12_i686.manylinux2010_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:1fcee592b4c6f146991ca55919ea3d1f8926497a713ed7faaf8225e174581e91", size = 275004 },
1095
- { url = "https://files.pythonhosted.org/packages/bf/b9/b0eb3f3cbcb734d930fdf839431606844a825b23eaf9a6ab371edac8162c/psutil-7.0.0-cp36-abi3-manylinux_2_12_x86_64.manylinux2010_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:4b1388a4f6875d7e2aff5c4ca1cc16c545ed41dd8bb596cefea80111db353a34", size = 277986 },
1096
- { url = "https://files.pythonhosted.org/packages/eb/a2/709e0fe2f093556c17fbafda93ac032257242cabcc7ff3369e2cb76a97aa/psutil-7.0.0-cp36-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:a5f098451abc2828f7dc6b58d44b532b22f2088f4999a937557b603ce72b1993", size = 279544 },
1097
- { url = "https://files.pythonhosted.org/packages/50/e6/eecf58810b9d12e6427369784efe814a1eec0f492084ce8eb8f4d89d6d61/psutil-7.0.0-cp37-abi3-win32.whl", hash = "sha256:ba3fcef7523064a6c9da440fc4d6bd07da93ac726b5733c29027d7dc95b39d99", size = 241053 },
1098
- { url = "https://files.pythonhosted.org/packages/50/1b/6921afe68c74868b4c9fa424dad3be35b095e16687989ebbb50ce4fceb7c/psutil-7.0.0-cp37-abi3-win_amd64.whl", hash = "sha256:4cf3d4eb1aa9b348dec30105c55cd9b7d4629285735a102beb4441e38db90553", size = 244885 },
1099
  ]
1100
 
1101
  [[package]]
@@ -1503,6 +1504,24 @@ wheels = [
1503
  { url = "https://files.pythonhosted.org/packages/e9/44/75a9c9421471a6c4805dbf2356f7c181a29c1879239abab1ea2cc8f38b40/sniffio-1.3.1-py3-none-any.whl", hash = "sha256:2f6da418d1f1e0fddd844478f41680e794e6051915791a034ff65e5f100525a2", size = 10235 },
1504
  ]
1505
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1506
  [[package]]
1507
  name = "starlette"
1508
  version = "0.46.2"
@@ -1642,7 +1661,7 @@ name = "triton"
1642
  version = "3.1.0"
1643
  source = { registry = "https://pypi.org/simple" }
1644
  dependencies = [
1645
- { name = "filelock" },
1646
  ]
1647
  wheels = [
1648
  { url = "https://files.pythonhosted.org/packages/98/29/69aa56dc0b2eb2602b553881e34243475ea2afd9699be042316842788ff5/triton-3.1.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:6b0dd10a925263abbe9fa37dcde67a5e9b2383fc269fdf59f5657cac38c5d1d8", size = 209460013 },
 
164
  { name = "bpy", version = "4.3.0", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.11'" },
165
  { name = "brickgpt" },
166
  { name = "gradio" },
167
+ { name = "spaces" },
168
  { name = "torch" },
169
  ]
170
 
 
173
  { name = "bpy", specifier = "<=4.3.0" },
174
  { name = "brickgpt", git = "https://github.com/AvaLovelace1/BrickGPT.git" },
175
  { name = "gradio" },
176
+ { name = "spaces", specifier = ">=0.37.0" },
177
  { name = "torch", specifier = "==2.5.1" },
178
  ]
179
 
 
1087
 
1088
  [[package]]
1089
  name = "psutil"
1090
+ version = "5.9.8"
1091
  source = { registry = "https://pypi.org/simple" }
1092
+ sdist = { url = "https://files.pythonhosted.org/packages/90/c7/6dc0a455d111f68ee43f27793971cf03fe29b6ef972042549db29eec39a2/psutil-5.9.8.tar.gz", hash = "sha256:6be126e3225486dff286a8fb9a06246a5253f4c7c53b475ea5f5ac934e64194c", size = 503247 }
1093
  wheels = [
1094
+ { url = "https://files.pythonhosted.org/packages/e7/e3/07ae864a636d70a8a6f58da27cb1179192f1140d5d1da10886ade9405797/psutil-5.9.8-cp36-abi3-macosx_10_9_x86_64.whl", hash = "sha256:aee678c8720623dc456fa20659af736241f575d79429a0e5e9cf88ae0605cc81", size = 248702 },
1095
+ { url = "https://files.pythonhosted.org/packages/b3/bd/28c5f553667116b2598b9cc55908ec435cb7f77a34f2bff3e3ca765b0f78/psutil-5.9.8-cp36-abi3-manylinux_2_12_i686.manylinux2010_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:8cb6403ce6d8e047495a701dc7c5bd788add903f8986d523e3e20b98b733e421", size = 285242 },
1096
+ { url = "https://files.pythonhosted.org/packages/c5/4f/0e22aaa246f96d6ac87fe5ebb9c5a693fbe8877f537a1022527c47ca43c5/psutil-5.9.8-cp36-abi3-manylinux_2_12_x86_64.manylinux2010_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:d06016f7f8625a1825ba3732081d77c94589dca78b7a3fc072194851e88461a4", size = 288191 },
1097
+ { url = "https://files.pythonhosted.org/packages/6e/f5/2aa3a4acdc1e5940b59d421742356f133185667dd190b166dbcfcf5d7b43/psutil-5.9.8-cp37-abi3-win32.whl", hash = "sha256:bc56c2a1b0d15aa3eaa5a60c9f3f8e3e565303b465dbf57a1b730e7a2b9844e0", size = 251252 },
1098
+ { url = "https://files.pythonhosted.org/packages/93/52/3e39d26feae7df0aa0fd510b14012c3678b36ed068f7d78b8d8784d61f0e/psutil-5.9.8-cp37-abi3-win_amd64.whl", hash = "sha256:8db4c1b57507eef143a15a6884ca10f7c73876cdf5d51e713151c1236a0e68cf", size = 255090 },
1099
+ { url = "https://files.pythonhosted.org/packages/05/33/2d74d588408caedd065c2497bdb5ef83ce6082db01289a1e1147f6639802/psutil-5.9.8-cp38-abi3-macosx_11_0_arm64.whl", hash = "sha256:d16bbddf0693323b8c6123dd804100241da461e41d6e332fb0ba6058f630f8c8", size = 249898 },
 
1100
  ]
1101
 
1102
  [[package]]
 
1504
  { url = "https://files.pythonhosted.org/packages/e9/44/75a9c9421471a6c4805dbf2356f7c181a29c1879239abab1ea2cc8f38b40/sniffio-1.3.1-py3-none-any.whl", hash = "sha256:2f6da418d1f1e0fddd844478f41680e794e6051915791a034ff65e5f100525a2", size = 10235 },
1505
  ]
1506
 
1507
+ [[package]]
1508
+ name = "spaces"
1509
+ version = "0.37.0"
1510
+ source = { registry = "https://pypi.org/simple" }
1511
+ dependencies = [
1512
+ { name = "gradio" },
1513
+ { name = "httpx" },
1514
+ { name = "packaging" },
1515
+ { name = "psutil" },
1516
+ { name = "pydantic" },
1517
+ { name = "requests" },
1518
+ { name = "typing-extensions" },
1519
+ ]
1520
+ sdist = { url = "https://files.pythonhosted.org/packages/54/c3/5983239c2269d993780a80c359513b534dea69a7f59c148877df6750f42e/spaces-0.37.0.tar.gz", hash = "sha256:07427994f2d422f40259635cc1de86b5b4fecd31ddd500b532c8e14db106b098", size = 24248 }
1521
+ wheels = [
1522
+ { url = "https://files.pythonhosted.org/packages/46/7f/18c1a47c5c0d9c62d8594ca7bd2f5fbe479651801a93e5dc14a2e6747833/spaces-0.37.0-py3-none-any.whl", hash = "sha256:8bdb0b8e7d27503b016d8c467986f25f9d2da52b4bfbeb02bc5722fbc25ffbef", size = 31233 },
1523
+ ]
1524
+
1525
  [[package]]
1526
  name = "starlette"
1527
  version = "0.46.2"
 
1661
  version = "3.1.0"
1662
  source = { registry = "https://pypi.org/simple" }
1663
  dependencies = [
1664
+ { name = "filelock", marker = "python_full_version < '3.13'" },
1665
  ]
1666
  wheels = [
1667
  { url = "https://files.pythonhosted.org/packages/98/29/69aa56dc0b2eb2602b553881e34243475ea2afd9699be042316842788ff5/triton-3.1.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:6b0dd10a925263abbe9fa37dcde67a5e9b2383fc269fdf59f5657cac38c5d1d8", size = 209460013 },