akhaliq HF Staff commited on
Commit
57843a1
·
1 Parent(s): 89dc200

add app file

Browse files
Files changed (1) hide show
  1. app.py +35 -0
app.py ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ import os
3
+
4
+ os.system("wget https://lfs.aminer.cn/misc/cogvideo/cogvideo-stage1.zip")
5
+
6
+
7
+ os.environ['NLAYERS'] = 48
8
+ os.environ['NHIDDEN'] = 3072
9
+ os.environ['NATT'] = 48
10
+ os.environ['MAXSEQLEN'] = 1024
11
+ os.environ['MPSIZE'] = 1
12
+
13
+
14
+
15
+
16
+ os.environ['TEMP'] = 1.05
17
+ os.environ['TOPK'] = 12
18
+
19
+
20
+ script_path=$(realpath $0)
21
+ script_dir=$(dirname $script_path)
22
+
23
+
24
+ os.environ['SAT_HOME'] = '/home/user/app/sharefs/cogview-new'
25
+
26
+ def inference(text):
27
+ os.system("""python cogvideo_pipeline.py --input-source interactive --output-path ./output --parallel-size 1 --both-stages --use-guidance-stage1 --guidance-alpha 3.0 --generate-frame-num 5 --tokenizer-type fake --mode inference --distributed-backend nccl --fp16 --model-parallel-size $MPSIZE --temperature $TEMP --coglm-temperature2 0.89 --top_k $TOPK --sandwich-ln --seed 1234 --num-workers 0 --batch-size 1 --max-inference-batch-size 1""")
28
+ return "out/out.mp4"
29
+
30
+ gr.Interface(inference,"text","video").launch()
31
+
32
+
33
+
34
+
35
+