Ivjnus commited on
Commit
767c286
·
verified ·
1 Parent(s): eb7c5a6

Upload folder using huggingface_hub

Browse files
Files changed (2) hide show
  1. app.py +33 -6
  2. requirements.txt +2 -0
app.py CHANGED
@@ -1,23 +1,50 @@
1
  import os
2
 
3
- # 防御:某些容器环境的 no_proxy 里有 [::1] 这种括号 IPv6,httpx 解析直接炸,
4
- # 连 import gradio 都过不去。先把它们清掉再 import。
5
  for _v in ("no_proxy", "NO_PROXY"):
6
  _val = os.environ.get(_v, "")
7
  if "[" in _val:
8
  os.environ[_v] = ",".join(p for p in _val.split(",") if "[" not in p)
9
 
 
10
  import gradio as gr
11
 
12
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
13
  def ping():
14
  return "alive"
15
 
16
 
17
  with gr.Blocks() as demo:
18
- gr.Markdown("debug-minimal")
19
- b = gr.Button("ping")
20
- o = gr.Textbox()
21
- b.click(ping, inputs=[], outputs=o)
 
 
 
22
 
23
  demo.launch()
 
1
  import os
2
 
3
+ # 防御:某些容器 no_proxy 里有 [::1] 这种括号 IPv6,httpx 解析直接炸
 
4
  for _v in ("no_proxy", "NO_PROXY"):
5
  _val = os.environ.get(_v, "")
6
  if "[" in _val:
7
  os.environ[_v] = ",".join(p for p in _val.split(",") if "[" not in p)
8
 
9
+ import spaces
10
  import gradio as gr
11
 
12
 
13
+ @spaces.GPU(duration=120)
14
+ def probe():
15
+ import traceback
16
+ out = []
17
+ try:
18
+ import torch
19
+ out.append(f"torch={torch.__version__} cuda={torch.cuda.is_available()}")
20
+ except Exception:
21
+ out.append("torch FAIL:\n" + traceback.format_exc()[-400:])
22
+ return "\n".join(out)
23
+ try:
24
+ import bitsandbytes
25
+ out.append(f"bitsandbytes={bitsandbytes.__version__} OK")
26
+ except Exception:
27
+ out.append("bitsandbytes FAIL:\n" + traceback.format_exc()[-400:])
28
+ try:
29
+ from diffsynth.pipelines.minimax_h3_audio_video import MiniMaxH3Pipeline, ModelConfig
30
+ import diffsynth
31
+ out.append(f"diffsynth={diffsynth.__version__} import OK")
32
+ except Exception:
33
+ out.append("diffsynth import FAIL:\n" + traceback.format_exc()[-600:])
34
+ return "\n".join(out)
35
+
36
+
37
  def ping():
38
  return "alive"
39
 
40
 
41
  with gr.Blocks() as demo:
42
+ gr.Markdown("debug-h3")
43
+ b1 = gr.Button("ping")
44
+ o1 = gr.Textbox()
45
+ b1.click(ping, inputs=[], outputs=o1)
46
+ b2 = gr.Button("probe gpu env")
47
+ o2 = gr.Textbox(lines=15)
48
+ b2.click(probe, inputs=[], outputs=o2)
49
 
50
  demo.launch()
requirements.txt CHANGED
@@ -1,2 +1,4 @@
1
  gradio>=4
2
  spaces
 
 
 
1
  gradio>=4
2
  spaces
3
+ bitsandbytes
4
+ git+https://github.com/modelscope/DiffSynth-Studio.git