File size: 1,793 Bytes
650c805
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# utils/lora_details.py

import gradio as gr
from utils.constants import LORA_DETAILS

def upd_prompt_notes(model_textbox_value):
    """
    Updates the prompt_notes_label with the notes from LORA_DETAILS.

    Args:
        model_textbox_value (str): The name of the LoRA model.

    Returns:
        gr.update: Updated Gradio label component with the notes.
    """
    notes = ""
    if model_textbox_value in LORA_DETAILS:
        lora_detail_list = LORA_DETAILS[model_textbox_value]
        for item in lora_detail_list:
            if 'notes' in item:
                notes = item['notes']
                break
    else:
        notes = "Enter Prompt description of your image"
    return gr.update(value=notes)

def get_trigger_words(model_textbox_value):
    """
    Retrieves the trigger words from constants.LORA_DETAILS for the specified model.

    Args:
        model_textbox_value (str): The name of the LoRA model.

    Returns:
        str: The trigger words associated with the model, or a default message if not found.
    """
    trigger_words = ""
    if model_textbox_value in LORA_DETAILS:
        lora_detail_list = LORA_DETAILS[model_textbox_value]
        for item in lora_detail_list:
            if 'trigger_words' in item:
                trigger_words = item['trigger_words']
                break
    else:
        trigger_words = ""
    return trigger_words

def upd_trigger_words(model_textbox_value):
    """
    Updates the trigger_words_label with the trigger words from LORA_DETAILS.

    Args:
        model_textbox_value (str): The name of the LoRA model.

    Returns:
        gr.update: Updated Gradio label component with the trigger words.
    """
    trigger_words = get_trigger_words(model_textbox_value)
    return gr.update(value=trigger_words)