Keltezaa commited on
Commit
0eae8cc
·
verified ·
1 Parent(s): ac25f79

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -6
app.py CHANGED
@@ -94,16 +94,18 @@ def download_file(url, directory=None):
94
  return filepath
95
 
96
  def get_trigger_word(base_model, lora_models):
97
- # Simulate the retrieval of a trigger word based on the selected models
98
- trigger_word = "<span style='color:green;'>default_trigger</span>" # Set default trigger word with green color
99
  if "lora1" in lora_models:
100
- trigger_word = f"<span style='color:green;'>{lora1.get('trigger_word', '')}</span>"
101
  if "lora2" in lora_models:
102
- trigger_word = f"<span style='color:green;'>{lora2.get('trigger_word', '')}</span>"
103
  if "lora3" in lora_models:
104
- trigger_word = f"<span style='color:green;'>{lora3.get('trigger_word', '')}</span>"
105
  if "lora4" in lora_models:
106
- trigger_word = f"<span style='color:green;'>{lora4.get('trigger_word', '')}</span>"
 
 
 
107
  return trigger_word
108
 
109
  def update_selection(evt: gr.SelectData, selected_indices, loras_state, width, height):
 
94
  return filepath
95
 
96
  def get_trigger_word(base_model, lora_models):
97
+ trigger_words = [] # Initialize an empty list to hold trigger words
 
98
  if "lora1" in lora_models:
99
+ trigger_words.append(lora1.get('trigger_word', ''))
100
  if "lora2" in lora_models:
101
+ trigger_words.append(lora2.get('trigger_word', ''))
102
  if "lora3" in lora_models:
103
+ trigger_words.append(lora3.get('trigger_word', ''))
104
  if "lora4" in lora_models:
105
+ trigger_words.append(lora4.get('trigger_word', ''))
106
+
107
+ # Join all trigger words with a space and wrap in a span
108
+ trigger_word = "<span style='color:green;'> " + " ".join(trigger_words) + " </span>"
109
  return trigger_word
110
 
111
  def update_selection(evt: gr.SelectData, selected_indices, loras_state, width, height):