Spaces:
hysts
/
Running on Zero

hysts HF Staff commited on
Commit
ad321d5
·
1 Parent(s): 446a941

Upgrade deps and migrate to Gradio 6

Browse files
Files changed (6) hide show
  1. .python-version +1 -1
  2. README.md +2 -1
  3. app.py +2 -2
  4. pyproject.toml +6 -4
  5. requirements.txt +118 -49
  6. uv.lock +0 -0
.python-version CHANGED
@@ -1 +1 @@
1
- 3.10
 
1
+ 3.12
README.md CHANGED
@@ -4,7 +4,8 @@ emoji: 🌖
4
  colorFrom: blue
5
  colorTo: pink
6
  sdk: gradio
7
- sdk_version: 5.12.0
 
8
  app_file: app.py
9
  pinned: false
10
  license: bsd-3-clause
 
4
  colorFrom: blue
5
  colorTo: pink
6
  sdk: gradio
7
+ sdk_version: 6.14.0
8
+ python_version: 3.12.12
9
  app_file: app.py
10
  pinned: false
11
  license: bsd-3-clause
app.py CHANGED
@@ -106,7 +106,7 @@ def chat(
106
  top_p: float = 0.9,
107
  history_orig: list[str] | None = None,
108
  history_qa: list[str] | None = None,
109
- ) -> tuple[list[tuple[str, str]], list[str], list[str]]:
110
  history_orig = history_orig or []
111
  history_qa = history_qa or []
112
  history_orig.append(text)
@@ -130,7 +130,7 @@ def chat(
130
  history_orig.append(output)
131
  history_qa.append(output)
132
 
133
- chat_val = list(zip(history_orig[0::2], history_orig[1::2], strict=False))
134
  return chat_val, history_orig, history_qa
135
 
136
 
 
106
  top_p: float = 0.9,
107
  history_orig: list[str] | None = None,
108
  history_qa: list[str] | None = None,
109
+ ) -> tuple[list[dict[str, str]], list[str], list[str]]:
110
  history_orig = history_orig or []
111
  history_qa = history_qa or []
112
  history_orig.append(text)
 
130
  history_orig.append(output)
131
  history_qa.append(output)
132
 
133
+ chat_val = [{"role": "user" if i % 2 == 0 else "assistant", "content": h} for i, h in enumerate(history_orig)]
134
  return chat_val, history_orig, history_qa
135
 
136
 
pyproject.toml CHANGED
@@ -3,13 +3,12 @@ name = "blip2"
3
  version = "0.1.0"
4
  description = ""
5
  readme = "README.md"
6
- requires-python = ">=3.10"
7
  dependencies = [
8
  "accelerate>=1.2.1",
9
  "bitsandbytes>=0.45.0",
10
- "gradio>=5.12.0",
11
- "hf-transfer>=0.1.9",
12
- "spaces>=0.32.0",
13
  "torch==2.4.0",
14
  "torchvision==0.19.0",
15
  "transformers>=4.48.0",
@@ -56,3 +55,6 @@ docstring-code-format = true
56
  dev = [
57
  "pre-commit>=4.6.0",
58
  ]
 
 
 
 
3
  version = "0.1.0"
4
  description = ""
5
  readme = "README.md"
6
+ requires-python = ">=3.12"
7
  dependencies = [
8
  "accelerate>=1.2.1",
9
  "bitsandbytes>=0.45.0",
10
+ "gradio[mcp,oauth]>=6.14.0",
11
+ "spaces>=0.48.3",
 
12
  "torch==2.4.0",
13
  "torchvision==0.19.0",
14
  "transformers>=4.48.0",
 
55
  dev = [
56
  "pre-commit>=4.6.0",
57
  ]
58
+ hf-spaces = [
59
+ "datasets",
60
+ ]
requirements.txt CHANGED
@@ -1,36 +1,53 @@
1
  # This file was autogenerated by uv via the following command:
2
- # uv pip compile pyproject.toml -o requirements.txt
3
  accelerate==1.2.1
4
- # via blip2 (pyproject.toml)
5
- aiofiles==23.2.1
6
- # via gradio
7
  annotated-types==0.7.0
8
  # via pydantic
9
  anyio==4.8.0
10
  # via
11
  # gradio
12
  # httpx
 
 
13
  # starlette
 
 
 
 
 
 
 
 
14
  bitsandbytes==0.45.0
15
- # via blip2 (pyproject.toml)
 
 
16
  certifi==2024.12.14
17
  # via
18
  # httpcore
19
  # httpx
20
  # requests
 
 
21
  charset-normalizer==3.4.1
22
  # via requests
23
  click==8.1.8
24
  # via
25
  # typer
26
  # uvicorn
27
- exceptiongroup==1.2.2
28
- # via anyio
 
 
 
 
 
 
 
29
  fastapi==0.115.6
30
  # via gradio
31
- ffmpy==0.5.0
32
- # via gradio
33
- filelock==3.16.1
34
  # via
35
  # huggingface-hub
36
  # torch
@@ -41,27 +58,36 @@ fsspec==2024.12.0
41
  # gradio-client
42
  # huggingface-hub
43
  # torch
44
- gradio==5.12.0
45
  # via
46
- # blip2 (pyproject.toml)
47
  # spaces
48
- gradio-client==1.5.4
 
 
 
 
49
  # via gradio
50
  h11==0.14.0
51
  # via
52
  # httpcore
53
  # uvicorn
54
- hf-transfer==0.1.9
55
- # via blip2 (pyproject.toml)
 
 
56
  httpcore==1.0.7
57
  # via httpx
58
  httpx==0.28.1
59
  # via
60
  # gradio
61
  # gradio-client
 
62
  # safehttpx
63
  # spaces
64
- huggingface-hub==0.27.1
 
 
65
  # via
66
  # accelerate
67
  # gradio
@@ -73,23 +99,33 @@ idna==3.10
73
  # anyio
74
  # httpx
75
  # requests
 
 
76
  jinja2==3.1.5
77
  # via
78
  # gradio
79
  # torch
 
 
 
 
 
 
80
  markdown-it-py==3.0.0
81
  # via rich
82
  markupsafe==2.1.5
83
  # via
84
  # gradio
85
  # jinja2
 
 
86
  mdurl==0.1.2
87
  # via markdown-it-py
88
  mpmath==1.3.0
89
  # via sympy
90
  networkx==3.4.2
91
  # via torch
92
- numpy==2.2.1
93
  # via
94
  # accelerate
95
  # bitsandbytes
@@ -97,36 +133,36 @@ numpy==2.2.1
97
  # pandas
98
  # torchvision
99
  # transformers
100
- nvidia-cublas-cu12==12.1.3.1
101
  # via
102
  # nvidia-cudnn-cu12
103
  # nvidia-cusolver-cu12
104
  # torch
105
- nvidia-cuda-cupti-cu12==12.1.105
106
  # via torch
107
- nvidia-cuda-nvrtc-cu12==12.1.105
108
  # via torch
109
- nvidia-cuda-runtime-cu12==12.1.105
110
  # via torch
111
- nvidia-cudnn-cu12==9.1.0.70
112
  # via torch
113
- nvidia-cufft-cu12==11.0.2.54
114
  # via torch
115
- nvidia-curand-cu12==10.3.2.106
116
  # via torch
117
- nvidia-cusolver-cu12==11.4.5.107
118
  # via torch
119
- nvidia-cusparse-cu12==12.1.0.106
120
  # via
121
  # nvidia-cusolver-cu12
122
  # torch
123
- nvidia-nccl-cu12==2.20.5
124
  # via torch
125
- nvidia-nvjitlink-cu12==12.6.85
126
  # via
127
  # nvidia-cusolver-cu12
128
  # nvidia-cusparse-cu12
129
- nvidia-nvtx-cu12==12.1.105
130
  # via torch
131
  orjson==3.10.14
132
  # via gradio
@@ -148,29 +184,49 @@ psutil==5.9.8
148
  # via
149
  # accelerate
150
  # spaces
151
- pydantic==2.10.5
 
 
152
  # via
153
  # fastapi
154
  # gradio
 
 
155
  # spaces
156
- pydantic-core==2.27.2
157
  # via pydantic
 
 
158
  pydub==0.25.1
159
  # via gradio
160
  pygments==2.19.1
161
  # via rich
 
 
162
  python-dateutil==2.9.0.post0
163
  # via pandas
 
 
164
  python-multipart==0.0.20
165
- # via gradio
 
 
166
  pytz==2024.2
167
- # via pandas
 
 
 
 
168
  pyyaml==6.0.2
169
  # via
170
  # accelerate
171
  # gradio
172
  # huggingface-hub
173
  # transformers
 
 
 
 
174
  regex==2024.11.6
175
  # via transformers
176
  requests==2.32.3
@@ -180,9 +236,11 @@ requests==2.32.3
180
  # transformers
181
  rich==13.9.4
182
  # via typer
183
- ruff==0.9.1
184
- # via gradio
185
- safehttpx==0.1.6
 
 
186
  # via gradio
187
  safetensors==0.5.2
188
  # via
@@ -190,18 +248,21 @@ safetensors==0.5.2
190
  # transformers
191
  semantic-version==2.10.0
192
  # via gradio
 
 
193
  shellingham==1.5.4
194
  # via typer
195
  six==1.17.0
196
  # via python-dateutil
197
  sniffio==1.3.1
198
  # via anyio
199
- spaces==0.32.0
200
- # via blip2 (pyproject.toml)
201
  starlette==0.41.3
202
  # via
203
  # fastapi
204
  # gradio
 
205
  sympy==1.13.3
206
  # via torch
207
  tokenizers==0.21.0
@@ -210,23 +271,25 @@ tomlkit==0.13.2
210
  # via gradio
211
  torch==2.4.0
212
  # via
213
- # blip2 (pyproject.toml)
214
  # accelerate
215
  # bitsandbytes
 
216
  # torchvision
217
  torchvision==0.19.0
218
- # via blip2 (pyproject.toml)
219
  tqdm==4.67.1
220
  # via
221
  # huggingface-hub
222
  # transformers
223
  transformers==4.48.0
224
- # via blip2 (pyproject.toml)
225
- triton==3.0.0
226
  # via torch
227
  typer==0.15.1
228
- # via gradio
229
- typing-extensions==4.12.2
 
 
230
  # via
231
  # anyio
232
  # bitsandbytes
@@ -234,18 +297,24 @@ typing-extensions==4.12.2
234
  # gradio
235
  # gradio-client
236
  # huggingface-hub
 
237
  # pydantic
238
  # pydantic-core
239
- # rich
240
  # spaces
241
  # torch
242
  # typer
243
- # uvicorn
 
 
 
 
 
244
  tzdata==2024.2
245
  # via pandas
246
  urllib3==2.3.0
247
  # via requests
248
  uvicorn==0.34.0
249
- # via gradio
250
- websockets==14.1
251
- # via gradio-client
 
1
  # This file was autogenerated by uv via the following command:
2
+ # uv export --no-hashes --no-dev --no-emit-package typer-slim --no-emit-package spaces -o requirements.txt
3
  accelerate==1.2.1
4
+ # via blip2
 
 
5
  annotated-types==0.7.0
6
  # via pydantic
7
  anyio==4.8.0
8
  # via
9
  # gradio
10
  # httpx
11
+ # mcp
12
+ # sse-starlette
13
  # starlette
14
+ attrs==26.1.0
15
+ # via
16
+ # jsonschema
17
+ # referencing
18
+ audioop-lts==0.2.1 ; python_full_version >= '3.13'
19
+ # via gradio
20
+ authlib==1.7.0
21
+ # via gradio
22
  bitsandbytes==0.45.0
23
+ # via blip2
24
+ brotli==1.2.0
25
+ # via gradio
26
  certifi==2024.12.14
27
  # via
28
  # httpcore
29
  # httpx
30
  # requests
31
+ cffi==2.0.0 ; platform_python_implementation != 'PyPy'
32
+ # via cryptography
33
  charset-normalizer==3.4.1
34
  # via requests
35
  click==8.1.8
36
  # via
37
  # typer
38
  # uvicorn
39
+ colorama==0.4.6 ; sys_platform == 'win32'
40
+ # via
41
+ # click
42
+ # tqdm
43
+ cryptography==47.0.0
44
+ # via
45
+ # authlib
46
+ # joserfc
47
+ # pyjwt
48
  fastapi==0.115.6
49
  # via gradio
50
+ filelock==3.29.0
 
 
51
  # via
52
  # huggingface-hub
53
  # torch
 
58
  # gradio-client
59
  # huggingface-hub
60
  # torch
61
+ gradio==6.14.0
62
  # via
63
+ # blip2
64
  # spaces
65
+ gradio-client==2.5.0
66
+ # via
67
+ # gradio
68
+ # hf-gradio
69
+ groovy==0.1.2
70
  # via gradio
71
  h11==0.14.0
72
  # via
73
  # httpcore
74
  # uvicorn
75
+ hf-gradio==0.4.1
76
+ # via gradio
77
+ hf-xet==1.4.3 ; platform_machine == 'aarch64' or platform_machine == 'amd64' or platform_machine == 'arm64' or platform_machine == 'x86_64'
78
+ # via huggingface-hub
79
  httpcore==1.0.7
80
  # via httpx
81
  httpx==0.28.1
82
  # via
83
  # gradio
84
  # gradio-client
85
+ # mcp
86
  # safehttpx
87
  # spaces
88
+ httpx-sse==0.4.3
89
+ # via mcp
90
+ huggingface-hub==0.36.2
91
  # via
92
  # accelerate
93
  # gradio
 
99
  # anyio
100
  # httpx
101
  # requests
102
+ itsdangerous==2.2.0
103
+ # via gradio
104
  jinja2==3.1.5
105
  # via
106
  # gradio
107
  # torch
108
+ joserfc==1.6.4
109
+ # via authlib
110
+ jsonschema==4.26.0
111
+ # via mcp
112
+ jsonschema-specifications==2025.9.1
113
+ # via jsonschema
114
  markdown-it-py==3.0.0
115
  # via rich
116
  markupsafe==2.1.5
117
  # via
118
  # gradio
119
  # jinja2
120
+ mcp==1.27.0
121
+ # via gradio
122
  mdurl==0.1.2
123
  # via markdown-it-py
124
  mpmath==1.3.0
125
  # via sympy
126
  networkx==3.4.2
127
  # via torch
128
+ numpy==1.26.4
129
  # via
130
  # accelerate
131
  # bitsandbytes
 
133
  # pandas
134
  # torchvision
135
  # transformers
136
+ nvidia-cublas-cu12==12.1.3.1 ; platform_machine == 'x86_64' and sys_platform == 'linux'
137
  # via
138
  # nvidia-cudnn-cu12
139
  # nvidia-cusolver-cu12
140
  # torch
141
+ nvidia-cuda-cupti-cu12==12.1.105 ; platform_machine == 'x86_64' and sys_platform == 'linux'
142
  # via torch
143
+ nvidia-cuda-nvrtc-cu12==12.1.105 ; platform_machine == 'x86_64' and sys_platform == 'linux'
144
  # via torch
145
+ nvidia-cuda-runtime-cu12==12.1.105 ; platform_machine == 'x86_64' and sys_platform == 'linux'
146
  # via torch
147
+ nvidia-cudnn-cu12==9.1.0.70 ; platform_machine == 'x86_64' and sys_platform == 'linux'
148
  # via torch
149
+ nvidia-cufft-cu12==11.0.2.54 ; platform_machine == 'x86_64' and sys_platform == 'linux'
150
  # via torch
151
+ nvidia-curand-cu12==10.3.2.106 ; platform_machine == 'x86_64' and sys_platform == 'linux'
152
  # via torch
153
+ nvidia-cusolver-cu12==11.4.5.107 ; platform_machine == 'x86_64' and sys_platform == 'linux'
154
  # via torch
155
+ nvidia-cusparse-cu12==12.1.0.106 ; platform_machine == 'x86_64' and sys_platform == 'linux'
156
  # via
157
  # nvidia-cusolver-cu12
158
  # torch
159
+ nvidia-nccl-cu12==2.20.5 ; platform_machine == 'x86_64' and sys_platform == 'linux'
160
  # via torch
161
+ nvidia-nvjitlink-cu12==12.6.85 ; platform_machine == 'x86_64' and sys_platform == 'linux'
162
  # via
163
  # nvidia-cusolver-cu12
164
  # nvidia-cusparse-cu12
165
+ nvidia-nvtx-cu12==12.1.105 ; platform_machine == 'x86_64' and sys_platform == 'linux'
166
  # via torch
167
  orjson==3.10.14
168
  # via gradio
 
184
  # via
185
  # accelerate
186
  # spaces
187
+ pycparser==3.0 ; implementation_name != 'PyPy' and platform_python_implementation != 'PyPy'
188
+ # via cffi
189
+ pydantic==2.12.5
190
  # via
191
  # fastapi
192
  # gradio
193
+ # mcp
194
+ # pydantic-settings
195
  # spaces
196
+ pydantic-core==2.41.5
197
  # via pydantic
198
+ pydantic-settings==2.14.0
199
+ # via mcp
200
  pydub==0.25.1
201
  # via gradio
202
  pygments==2.19.1
203
  # via rich
204
+ pyjwt==2.12.1
205
+ # via mcp
206
  python-dateutil==2.9.0.post0
207
  # via pandas
208
+ python-dotenv==1.2.2
209
+ # via pydantic-settings
210
  python-multipart==0.0.20
211
+ # via
212
+ # gradio
213
+ # mcp
214
  pytz==2024.2
215
+ # via
216
+ # gradio
217
+ # pandas
218
+ pywin32==311 ; sys_platform == 'win32'
219
+ # via mcp
220
  pyyaml==6.0.2
221
  # via
222
  # accelerate
223
  # gradio
224
  # huggingface-hub
225
  # transformers
226
+ referencing==0.37.0
227
+ # via
228
+ # jsonschema
229
+ # jsonschema-specifications
230
  regex==2024.11.6
231
  # via transformers
232
  requests==2.32.3
 
236
  # transformers
237
  rich==13.9.4
238
  # via typer
239
+ rpds-py==0.30.0
240
+ # via
241
+ # jsonschema
242
+ # referencing
243
+ safehttpx==0.1.7
244
  # via gradio
245
  safetensors==0.5.2
246
  # via
 
248
  # transformers
249
  semantic-version==2.10.0
250
  # via gradio
251
+ setuptools==82.0.1
252
+ # via torch
253
  shellingham==1.5.4
254
  # via typer
255
  six==1.17.0
256
  # via python-dateutil
257
  sniffio==1.3.1
258
  # via anyio
259
+ sse-starlette==3.0.3
260
+ # via mcp
261
  starlette==0.41.3
262
  # via
263
  # fastapi
264
  # gradio
265
+ # mcp
266
  sympy==1.13.3
267
  # via torch
268
  tokenizers==0.21.0
 
271
  # via gradio
272
  torch==2.4.0
273
  # via
 
274
  # accelerate
275
  # bitsandbytes
276
+ # blip2
277
  # torchvision
278
  torchvision==0.19.0
279
+ # via blip2
280
  tqdm==4.67.1
281
  # via
282
  # huggingface-hub
283
  # transformers
284
  transformers==4.48.0
285
+ # via blip2
286
+ triton==3.0.0 ; python_full_version < '3.13' and platform_machine == 'x86_64' and sys_platform == 'linux'
287
  # via torch
288
  typer==0.15.1
289
+ # via
290
+ # gradio
291
+ # hf-gradio
292
+ typing-extensions==4.15.0
293
  # via
294
  # anyio
295
  # bitsandbytes
 
297
  # gradio
298
  # gradio-client
299
  # huggingface-hub
300
+ # mcp
301
  # pydantic
302
  # pydantic-core
303
+ # referencing
304
  # spaces
305
  # torch
306
  # typer
307
+ # typing-inspection
308
+ typing-inspection==0.4.2
309
+ # via
310
+ # mcp
311
+ # pydantic
312
+ # pydantic-settings
313
  tzdata==2024.2
314
  # via pandas
315
  urllib3==2.3.0
316
  # via requests
317
  uvicorn==0.34.0
318
+ # via
319
+ # gradio
320
+ # mcp
uv.lock CHANGED
The diff for this file is too large to render. See raw diff