Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -7,19 +7,18 @@ from huggingface_hub import login
|
|
7 |
import os
|
8 |
|
9 |
# Retrieve the token from an environment variable
|
10 |
-
|
11 |
|
12 |
-
|
13 |
-
|
14 |
|
15 |
# Log in using the token
|
16 |
-
|
17 |
|
18 |
# Define a function that takes a text input and returns an image.
|
19 |
def text_to_image(text : str):
|
20 |
-
|
21 |
-
|
22 |
-
pipe = gr.load("models/gokaygokay/Flux-Game-Assets-LoRA-v2").launch()
|
23 |
prompt = text
|
24 |
image = pipe(prompt).images[0]
|
25 |
return image
|
|
|
7 |
import os
|
8 |
|
9 |
# Retrieve the token from an environment variable
|
10 |
+
access_token = os.getenv('black-forest-labs/FLUX.1') # Replace with the correct variable name
|
11 |
|
12 |
+
if access_token is None:
|
13 |
+
raise ValueError("Token is not set in the environment variable.")
|
14 |
|
15 |
# Log in using the token
|
16 |
+
login(token=token)
|
17 |
|
18 |
# Define a function that takes a text input and returns an image.
|
19 |
def text_to_image(text : str):
|
20 |
+
pipe = DiffusionPipeline.from_pretrained("black-forest-labs/FLUX.1-dev")
|
21 |
+
pipe.load_lora_weights("gokaygokay/Flux-Game-Assets-LoRA-v2")
|
|
|
22 |
prompt = text
|
23 |
image = pipe(prompt).images[0]
|
24 |
return image
|