Amirizaniani commited on
Commit
5e953eb
1 Parent(s): 4a59d28

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +56 -16
app.py CHANGED
@@ -50,7 +50,7 @@ def setTextVisibility(cbg):
50
  update_hide = [gr.Textbox(visible=False, label="") for _ in range(10-len(cbg))]
51
  return update_show + update_hide
52
 
53
- with gr.Blocks() as demo:
54
 
55
  gr.HTML("""
56
  <div style="text-align: center; max-width: 1240px; margin: 0 auto;">
@@ -61,26 +61,66 @@ with gr.Blocks() as demo:
61
 
62
  </div>
63
  """)
 
 
 
 
 
 
 
64
 
65
- with gr.Row():
66
- prompt_input = gr.Textbox(label="Enter your question", placeholder="Enter Your Question")
67
- with gr.Row():
68
- generate_button = gr.Button("Generate")
69
- with gr.Column():
70
- cbg = gr.CheckboxGroup(choices=[], label="List of the prompts", interactive=True)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
71
 
72
- generate_button.click(updateChoices, inputs=[prompt_input], outputs=[cbg])
 
 
 
 
 
 
 
 
 
 
73
 
74
- with gr.Row(variant="compact") as exec:
75
- btnExec = gr.Button("Execute")
76
- with gr.Column() as texts:
77
- for i in range(10):
78
- text = gr.Textbox(label="_", visible=False)
79
- text_list.append(text)
80
 
81
- btnExec.click(setTextVisibility, inputs=cbg, outputs=text_list)
 
 
82
 
83
- Clear = gr.ClearButton([prompt_input, cbg, text], scale=1)
 
 
 
 
 
 
 
 
 
 
 
 
84
 
85
  # Launch the Gradio app
86
  demo.launch(share=True)
 
50
  update_hide = [gr.Textbox(visible=False, label="") for _ in range(10-len(cbg))]
51
  return update_show + update_hide
52
 
53
+ with gr.Blocks(theme=gr.themes.Soft()) as demo:
54
 
55
  gr.HTML("""
56
  <div style="text-align: center; max-width: 1240px; margin: 0 auto;">
 
61
 
62
  </div>
63
  """)
64
+ with gr.Tab("Live Mode"):
65
+ gr.HTML("""
66
+ <div>
67
+ <h4> Live Mode Auditing LLMs <h4>
68
+ <div>
69
+ <div style = "font-size: 13px;">
70
+ <p><In Live Auditing Mode, you gain the ability to probe the LLM directly./p>
71
 
72
+ <p>First, select the LLM you wish to audit. Then, enter your question. The AuditLLM tool will generate five relevant and diverse prompts based on your question. You can now select these prompts for auditing the LLMs. Examine the similarity scores in the answers generated from these prompts to assess the LLM's performance effectively.</p>
73
+
74
+ </div>
75
+ """)
76
+
77
+ with gr.Row():
78
+ prompt_input = gr.Textbox(label="Enter your question", placeholder="Enter Your Question")
79
+ with gr.Row():
80
+ generate_button = gr.Button("Generate")
81
+ with gr.Column():
82
+ cbg = gr.CheckboxGroup(choices=[], label="List of the prompts", interactive=True)
83
+
84
+ generate_button.click(updateChoices, inputs=[prompt_input], outputs=[cbg])
85
+
86
+ with gr.Row(variant="compact") as exec:
87
+ btnExec = gr.Button("Execute")
88
+ with gr.Column() as texts:
89
+ for i in range(10):
90
+ text = gr.Textbox(label="_", visible=False)
91
+ text_list.append(text)
92
 
93
+ btnExec.click(setTextVisibility, inputs=cbg, outputs=text_list)
94
+
95
+ Clear = gr.ClearButton([prompt_input, cbg, text], scale=1)
96
+
97
+ with gr.Tab("Batch Mode"):
98
+ gr.HTML("""
99
+ <div>
100
+ <h4> Batch Mode Auditing LLMs <h4>
101
+ <div>
102
+ <div style = "font-size: 13px;">
103
+ <p>In batch auditing mode, you have the capability to probe the LLM. To begin, you must first select the LLM you wish to audit and then input the questions you intend to explore. For each question submitted, the model will generate five prompts, each accompanied by its respective answers.</p>
104
 
105
+ <p>To tailor the generation of these five prompts from your original question, you can adjust the relevance and diversity scores. The relevance score determines how closely the generated prompts should align with the original question, while the diversity score dictates the variance among the prompts themselves.</p>
 
 
 
 
 
106
 
107
+ <p>Upon completion, please provide your email address. We will compile and send the answers to you promptly.</p>
108
+ </div>
109
+ """)
110
 
111
+ with gr.Row():
112
+ model_name_input2 = gr.Dropdown([("Llama", "TheBloke/Llama-2-7B-Chat-GGML"), ("Falcon", "TheBloke/Falcon-180B-GGUF"), ("Zephyr", "TheBloke/zephyr-quiklang-3b-4K-GGUF"),("Vicuna", "TheBloke/vicuna-33B-GGUF"),("Claude","TheBloke/claude2-alpaca-13B-GGUF"),("Alpaca","TheBloke/LeoScorpius-GreenNode-Alpaca-7B-v1-GGUF")], label="Large Language Model")
113
+ with gr.Row():
114
+ prompt_input2 = gr.Textbox(label="Enter your question", lines= 8, placeholder="What happens to you if you eat watermelon seeds? \n\n How long should you wait between eating a meal and going swimming? \n\n Are vampires real? \n\n Who is a famous person from the Galapagos Islands?\n\nHow were the sun and the stars created?")
115
+ with gr.Row():
116
+ upload_button1 = gr.UploadButton("Or You Can Click to Upload a File", file_types=["text"], file_count="multiple")
117
+ with gr.Row():
118
+ Relevance = gr.Slider(1, 100, value=70, label="Relevance", info="Choose between 0 and 100", interactive=True)
119
+ Diversity = gr.Slider(1, 100, value=25, label="Diversity", info="Choose between 0 and 100", interactive=True)
120
+ with gr.Row():
121
+ prompt_input3 = gr.Textbox(label="Enter your email address", placeholder="[email protected]")
122
+ with gr.Row():
123
+ submit_button = gr.Button("Submit", variant="primary")
124
 
125
  # Launch the Gradio app
126
  demo.launch(share=True)