File size: 1,323 Bytes
54d25d7
 
 
 
890e747
 
54d25d7
890e747
 
a597063
890e747
 
 
a597063
 
890e747
 
 
 
 
64e66df
890e747
 
9a97606
a597063
 
 
 
9a97606
64e66df
890e747
 
 
 
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
import gradio as gr
from helper_functions import *

with gr.Blocks() as app:
    gr.Markdown('# Prompt Generator for FundedNext')
    session_data = gr.State([{"current_system_prompt": ""}])
    
    with gr.Tab("Generate Prompt"):
        user_message = gr.Textbox(label = "Enter your message")
        prompt = gr.Textbox(label="Generated Prompt", interactive=True, lines=20).style(show_copy_button=True)
    with gr.Tab("Edit System Prompt"):
        system_prompt = gr.Textbox(
            label="System Prompt", interactive=True, lines=15
        ).style(show_copy_button=True)
        save_s_p = gr.Button("Save System Prompt")
        gr.Markdown("## System Prompt Examples")
        gr.Examples(
            examples = [[pre_text]],
            inputs = [system_prompt]
        )

    user_message.submit(
        fn = get_prompt, inputs = [user_message, session_data], outputs = prompt
    ).then(lambda:"", inputs=None, outputs=user_message, queue=False)
    save_s_p.click(
        fn = set_pre_text, inputs = [system_prompt, session_data], outputs = session_data, queue=False
    )
    system_prompt.submit(
        fn = set_pre_text, inputs = [system_prompt, session_data], outputs = session_data, queue=False
    )
    

app.launch(auth=(os.getenv("id"), os.getenv("password")), show_api=False)
# app.launch()