fwfwfrf commited on
Commit
e5ee8a4
·
verified ·
1 Parent(s): de2ce71

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +17 -2
app.py CHANGED
@@ -6,7 +6,22 @@ import json
6
  import torch
7
  from diffusers import FluxPipeline, AutoencoderKL
8
  from live_preview_helpers import flux_pipe_call_that_returns_an_iterable_of_images
9
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
10
  device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
11
 
12
  pipe = FluxPipeline.from_pretrained("black-forest-labs/FLUX.1-Krea-dev", torch_dtype=torch.bfloat16).to(device)
@@ -17,7 +32,7 @@ good_vae = AutoencoderKL.from_pretrained("black-forest-labs/FLUX.1-Krea-dev", su
17
  # pipe.to(torch.float16)
18
  pipe.flux_pipe_call_that_returns_an_iterable_of_images = flux_pipe_call_that_returns_an_iterable_of_images.__get__(pipe)
19
 
20
- llm_client = Client("Qwen/Qwen3-235B-A22B-Instruct-2507")
21
  # t2i_client = Client("black-forest-labs/FLUX.1-dev")
22
  # t2i_client = Client("black-forest-labs/FLUX.1-schnell")
23
 
 
6
  import torch
7
  from diffusers import FluxPipeline, AutoencoderKL
8
  from live_preview_helpers import flux_pipe_call_that_returns_an_iterable_of_images
9
+ from huggingface_hub import InferenceClient
10
+
11
+ client = InferenceClient(
12
+ provider="hf-inference",
13
+ api_key=os.environ["HF_TOKEN"],
14
+ )
15
+
16
+ response = client.chat.completions.create(
17
+ model="Qwen/Qwen3-235B-A22B-Instruct-2507",
18
+ messages=[
19
+ {"role": "system", "content": "You are a helpful assistant."},
20
+ {"role": "user", "content": prompt},
21
+ ],
22
+ )
23
+
24
+ text = response.choices[0].message.content
25
  device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
26
 
27
  pipe = FluxPipeline.from_pretrained("black-forest-labs/FLUX.1-Krea-dev", torch_dtype=torch.bfloat16).to(device)
 
32
  # pipe.to(torch.float16)
33
  pipe.flux_pipe_call_that_returns_an_iterable_of_images = flux_pipe_call_that_returns_an_iterable_of_images.__get__(pipe)
34
 
35
+ #llm_client = Client("Qwen/Qwen3-235B-A22B-Instruct-2507")
36
  # t2i_client = Client("black-forest-labs/FLUX.1-dev")
37
  # t2i_client = Client("black-forest-labs/FLUX.1-schnell")
38