Spaces:
Runtime error
Runtime error
artificialguybr
commited on
Commit
•
9c246bf
1
Parent(s):
96dff1a
Update app.py
Browse files
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 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
|
|
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 |
|