JaceWei commited on
Commit
80331d3
·
1 Parent(s): 0b3bb96
Files changed (1) hide show
  1. app.py +23 -0
app.py CHANGED
@@ -1,6 +1,29 @@
1
  import gradio as gr
2
  import subprocess, shutil, os, zipfile, datetime
3
  from pathlib import Path
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4
 
5
  ROOT = Path(__file__).resolve().parent
6
  OUTPUT_DIR = ROOT / "output"
 
1
  import gradio as gr
2
  import subprocess, shutil, os, zipfile, datetime
3
  from pathlib import Path
4
+ def _ensure_versions():
5
+ import importlib, subprocess, sys
6
+ def ver(pkg):
7
+ try:
8
+ m = importlib.import_module(pkg)
9
+ return getattr(m, "__version__", "0")
10
+ except Exception:
11
+ return "0"
12
+
13
+ hub_ok = False
14
+ try:
15
+ from packaging.version import Version
16
+ hv = Version(ver("huggingface_hub"))
17
+ hub_ok = Version("0.24.0") <= hv < Version("1.0.0")
18
+ except Exception:
19
+ pass
20
+
21
+ if not hub_ok:
22
+ subprocess.check_call([sys.executable, "-m", "pip",
23
+ "install", "huggingface-hub==0.27.1",
24
+ "transformers==4.48.0",
25
+ "--force-reinstall", "--no-deps"])
26
+ _ensure_versions()
27
 
28
  ROOT = Path(__file__).resolve().parent
29
  OUTPUT_DIR = ROOT / "output"