2023-03-11 20:11:15 +01:00
|
|
|
import gradio as gr
|
|
|
|
import modules.shared as shared
|
|
|
|
import pandas as pd
|
|
|
|
|
|
|
|
df = pd.read_csv("https://raw.githubusercontent.com/devbrones/llama-prompts/main/prompts/prompts.csv")
|
|
|
|
|
2023-04-07 05:15:45 +02:00
|
|
|
|
2023-03-11 20:11:15 +01:00
|
|
|
def get_prompt_by_name(name):
|
|
|
|
if name == 'None':
|
|
|
|
return ''
|
|
|
|
else:
|
|
|
|
return df[df['Prompt name'] == name].iloc[0]['Prompt'].replace('\\n', '\n')
|
|
|
|
|
2023-04-07 05:15:45 +02:00
|
|
|
|
2023-03-11 20:11:15 +01:00
|
|
|
def ui():
|
2023-04-02 01:14:43 +02:00
|
|
|
if not shared.is_chat():
|
2023-03-11 20:11:15 +01:00
|
|
|
choices = ['None'] + list(df['Prompt name'])
|
|
|
|
|
|
|
|
prompts_menu = gr.Dropdown(value=choices[0], choices=choices, label='Prompt')
|
|
|
|
prompts_menu.change(get_prompt_by_name, prompts_menu, shared.gradio['textbox'])
|