Yaron Koresh commited on
Commit
af97d45
·
verified ·
1 Parent(s): e1adbde

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -4
app.py CHANGED
@@ -9,14 +9,15 @@ import gradio as gr
9
  import numpy as np
10
  from lxml.html import fromstring
11
  from pathos.threading import ThreadPool as Pool
12
- #from diffusers import DiffusionPipeline,
13
- from diffusers.pipelines.flux import FluxPipeline
14
  #from diffusers.utils import export_to_gif
15
  #from huggingface_hub import hf_hub_download
16
  #from safetensors.torch import load_file
 
17
 
18
  device = "cuda" if torch.cuda.is_available() else "cpu"
19
- pipe = FluxPipeline.from_pretrained("black-forest-labs/FLUX.1-schnell", torch_dtype=torch.bfloat16, token=os.getenv("hf_token")).to(device)
20
 
21
  def translate(text,lang):
22
 
@@ -95,7 +96,7 @@ def Piper(_do,neg):
95
 
96
  @spaces.GPU(duration=25)
97
  def negator(_dont):
98
- neg = pipe.tokenizer(_dont)['input_ids']
99
  print(neg)
100
  return neg
101
 
 
9
  import numpy as np
10
  from lxml.html import fromstring
11
  from pathos.threading import ThreadPool as Pool
12
+ from diffusers import FlaxDiffusionPipeline
13
+ #from diffusers.pipelines.flux import FluxPipeline
14
  #from diffusers.utils import export_to_gif
15
  #from huggingface_hub import hf_hub_download
16
  #from safetensors.torch import load_file
17
+ #from diffusers import FlaxStableDiffusionXLPipeline
18
 
19
  device = "cuda" if torch.cuda.is_available() else "cpu"
20
+ pipe = FlaxDiffusionPipeline.from_pretrained("black-forest-labs/FLUX.1-schnell", torch_dtype=torch.bfloat16, token=os.getenv("hf_token")).to(device)
21
 
22
  def translate(text,lang):
23
 
 
96
 
97
  @spaces.GPU(duration=25)
98
  def negator(_dont):
99
+ neg = pipe.prepare_inputs(_dont)
100
  print(neg)
101
  return neg
102