Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -13,6 +13,10 @@ import yaml
|
|
13 |
with open('config.yaml', 'r') as file:
|
14 |
config = yaml.safe_load(file)
|
15 |
|
|
|
|
|
|
|
|
|
16 |
# Authenticate using the token stored in Hugging Face Spaces secrets
|
17 |
if 'HF_TOKEN' in os.environ:
|
18 |
login(token=os.environ['HF_TOKEN'])
|
@@ -20,10 +24,22 @@ else:
|
|
20 |
raise ValueError("HF_TOKEN not found in environment variables. Please add it to your Space's secrets.")
|
21 |
|
22 |
# Correctly access the config values
|
23 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
24 |
lora_model = "sagar007/sagar_flux" # This isn't in the config, so we're keeping it as is
|
25 |
-
trigger_word = config['config']['trigger_word']
|
26 |
|
|
|
|
|
|
|
|
|
|
|
27 |
# Global variables
|
28 |
pipe = None
|
29 |
cache = {}
|
|
|
13 |
with open('config.yaml', 'r') as file:
|
14 |
config = yaml.safe_load(file)
|
15 |
|
16 |
+
# Debug: Print the structure of the config
|
17 |
+
print("Config structure:")
|
18 |
+
print(yaml.dump(config, default_flow_style=False))
|
19 |
+
|
20 |
# Authenticate using the token stored in Hugging Face Spaces secrets
|
21 |
if 'HF_TOKEN' in os.environ:
|
22 |
login(token=os.environ['HF_TOKEN'])
|
|
|
24 |
raise ValueError("HF_TOKEN not found in environment variables. Please add it to your Space's secrets.")
|
25 |
|
26 |
# Correctly access the config values
|
27 |
+
try:
|
28 |
+
base_model = config['config']['model']['name_or_path']
|
29 |
+
except KeyError:
|
30 |
+
print("Could not find 'config' -> 'model' -> 'name_or_path' in the config file.")
|
31 |
+
print("Available keys in config:", list(config.keys()))
|
32 |
+
if 'config' in config:
|
33 |
+
print("Available keys in config['config']:", list(config['config'].keys()))
|
34 |
+
base_model = "FLUX.1-dev" # Default value
|
35 |
+
|
36 |
lora_model = "sagar007/sagar_flux" # This isn't in the config, so we're keeping it as is
|
|
|
37 |
|
38 |
+
try:
|
39 |
+
trigger_word = config['config']['trigger_word']
|
40 |
+
except KeyError:
|
41 |
+
print("Could not find 'config' -> 'trigger_word' in the config file.")
|
42 |
+
trigger_word = "sagar"
|
43 |
# Global variables
|
44 |
pipe = None
|
45 |
cache = {}
|