artificialguybr commited on
Commit
9c246bf
1 Parent(s): 96dff1a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -11
app.py CHANGED
@@ -12,17 +12,18 @@ class SomeClass:
12
  with open('loras.json', 'r') as f:
13
  loras = json.load(f)
14
 
15
- def update_selection(selected_state):
16
- print(f"Debug: selected_state = {selected_state}") # Debugging line
17
- if selected_state is not None:
18
- selected_lora_index = selected_state.index
19
- selected_lora = loras[selected_lora_index]
20
- new_placeholder = f"Type a prompt for {selected_lora['title']}"
21
- lora_repo = selected_lora["repo"]
22
- updated_text = f"### Selected: [{lora_repo}](https://huggingface.co/{lora_repo}) ✨"
23
- return (gr.update(placeholder=new_placeholder), updated_text, selected_state)
24
- else:
25
- return (gr.update(placeholder="Select a Lora first"), "No Lora selected", None)
 
26
 
27
 
28
 
 
12
  with open('loras.json', 'r') as f:
13
  loras = json.load(f)
14
 
15
+ def update_selection(selected_state: gr.SelectData):
16
+ logging.debug(f"Inside update_selection, selected_state: {selected_state}")
17
+ selected_lora_index = selected_state.index
18
+ selected_lora = loras[selected_lora_index]
19
+ new_placeholder = f"Type a prompt for {selected_lora['title']}"
20
+ lora_repo = selected_lora["repo"]
21
+ updated_text = f"### Selected: [{lora_repo}](https://huggingface.co/{lora_repo}) ✨"
22
+ return (
23
+ gr.update(placeholder=new_placeholder),
24
+ updated_text, # Retorna o texto Markdown atualizado
25
+ selected_state
26
+ )
27
 
28
 
29