aiqtech commited on
Commit
bf17117
·
verified ·
1 Parent(s): 7eea7d0

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +21 -10
app.py CHANGED
@@ -4,6 +4,15 @@ import torch
4
  import argparse
5
  import torchvision
6
 
 
 
 
 
 
 
 
 
 
7
  from pipelines.pipeline_videogen import VideoGenPipeline
8
  from diffusers.schedulers import DDIMScheduler
9
  from diffusers.models import AutoencoderKL
@@ -11,7 +20,7 @@ from diffusers.models import AutoencoderKLTemporalDecoder
11
  from transformers import CLIPTokenizer, CLIPTextModel
12
  from omegaconf import OmegaConf
13
 
14
- import os, sys
15
  sys.path.append(os.path.split(sys.path[0])[0])
16
  from models import get_models
17
  import imageio
@@ -27,10 +36,6 @@ import requests
27
  from datetime import datetime
28
  import random
29
 
30
- # Disable any automatic translation or localization
31
- os.environ['TRANSFORMERS_OFFLINE'] = '1' # Prevent auto-downloading of models
32
- os.environ['HF_DATASETS_OFFLINE'] = '1' # Prevent auto-downloading of datasets
33
-
34
  parser = argparse.ArgumentParser()
35
  parser.add_argument("--config", type=str, default="./configs/sample.yaml")
36
  args = parser.parse_args()
@@ -246,8 +251,8 @@ footer {
246
  }
247
  """
248
 
249
- # Create Gradio interface
250
- with gr.Blocks(theme="soft", css=css) as demo:
251
  gr.Markdown("# Video Generation with DCTInit")
252
  gr.Markdown("Generate videos from static images. Please use English prompts only.")
253
 
@@ -407,7 +412,7 @@ with gr.Blocks(theme="soft", css=css) as demo:
407
  seed_textbox
408
  ],
409
  outputs=[result_video],
410
- cache_examples="lazy",
411
  )
412
 
413
  generate_button.click(
@@ -429,5 +434,11 @@ with gr.Blocks(theme="soft", css=css) as demo:
429
  outputs=[result_video]
430
  )
431
 
432
- # Launch the interface
433
- demo.launch(debug=False, share=True, server_name="127.0.0.1")
 
 
 
 
 
 
 
4
  import argparse
5
  import torchvision
6
 
7
+ # Disable all automatic translation and model downloading BEFORE any imports
8
+ os.environ['TRANSFORMERS_OFFLINE'] = '1'
9
+ os.environ['HF_DATASETS_OFFLINE'] = '1'
10
+ os.environ['TOKENIZERS_PARALLELISM'] = 'false'
11
+ os.environ['GRADIO_ANALYTICS_ENABLED'] = 'false'
12
+ # Disable translation specifically
13
+ os.environ['GRADIO_TRANSLATION_ENABLED'] = 'false'
14
+ os.environ['GRADIO_ALLOW_FLAGGING'] = 'never'
15
+
16
  from pipelines.pipeline_videogen import VideoGenPipeline
17
  from diffusers.schedulers import DDIMScheduler
18
  from diffusers.models import AutoencoderKL
 
20
  from transformers import CLIPTokenizer, CLIPTextModel
21
  from omegaconf import OmegaConf
22
 
23
+ import sys
24
  sys.path.append(os.path.split(sys.path[0])[0])
25
  from models import get_models
26
  import imageio
 
36
  from datetime import datetime
37
  import random
38
 
 
 
 
 
39
  parser = argparse.ArgumentParser()
40
  parser.add_argument("--config", type=str, default="./configs/sample.yaml")
41
  args = parser.parse_args()
 
251
  }
252
  """
253
 
254
+ # Create Gradio interface with translation disabled
255
+ with gr.Blocks(theme="soft", css=css, analytics_enabled=False) as demo:
256
  gr.Markdown("# Video Generation with DCTInit")
257
  gr.Markdown("Generate videos from static images. Please use English prompts only.")
258
 
 
412
  seed_textbox
413
  ],
414
  outputs=[result_video],
415
+ cache_examples=False, # Changed from "lazy" to False to avoid caching issues
416
  )
417
 
418
  generate_button.click(
 
434
  outputs=[result_video]
435
  )
436
 
437
+ # Launch the interface with analytics disabled
438
+ demo.launch(
439
+ debug=False,
440
+ share=True,
441
+ server_name="127.0.0.1",
442
+ analytics_enabled=False,
443
+ enable_queue=True
444
+ )