Clone04 commited on
Commit
3a4d850
·
verified ·
1 Parent(s): e2846e2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -8
app.py CHANGED
@@ -1,16 +1,10 @@
1
  import gradio as gr
2
  from optimum.intel import OVDiffusionPipeline
3
- from transformers import AutoTokenizer
4
  from threading import Lock
5
 
6
- # Load the pipeline and tokenizer globally
7
  model_id = "OpenVINO/FLUX.1-schnell-int4-ov"
8
  pipeline = OVDiffusionPipeline.from_pretrained(model_id, device="CPU")
9
-
10
- # Explicitly load the tokenizer with fast settings
11
- tokenizer = AutoTokenizer.from_pretrained("t5-v1_1-xxl", use_fast=True, add_prefix_space=True)
12
- pipeline.text_encoder_2.tokenizer = tokenizer # Assign the tokenizer to the T5 encoder
13
-
14
  lock = Lock()
15
 
16
  # Define the image generation function
@@ -32,4 +26,4 @@ interface = gr.Interface(
32
 
33
  # Launch the interface
34
  if __name__ == "__main__":
35
- interface.launch() # Removed queue=True for compatibility
 
1
  import gradio as gr
2
  from optimum.intel import OVDiffusionPipeline
 
3
  from threading import Lock
4
 
5
+ # Load the pipeline globally (includes the correct tokenizer)
6
  model_id = "OpenVINO/FLUX.1-schnell-int4-ov"
7
  pipeline = OVDiffusionPipeline.from_pretrained(model_id, device="CPU")
 
 
 
 
 
8
  lock = Lock()
9
 
10
  # Define the image generation function
 
26
 
27
  # Launch the interface
28
  if __name__ == "__main__":
29
+ interface.launch()