Ouz commited on
Commit
ebeb9b4
·
1 Parent(s): c9440d5
Files changed (1) hide show
  1. app.py +52 -21
app.py CHANGED
@@ -3,6 +3,26 @@ from root import RootSignals
3
 
4
  client = None
5
  custom_judge = None
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6
 
7
  def initialize_client(api_key):
8
  global client
@@ -21,11 +41,7 @@ def create_judge(api_key, judge_name, intent, judge_prompt):
21
  model="gpt-4o",
22
  )
23
 
24
- # Update the visibility of the evaluation and results sections
25
- eval_section.visible = True
26
- results_section.visible = True
27
- evaluate_btn.visible = True
28
- return gr.Info(f"Custom LLM-Judge {judge_name} is created successfully!")
29
 
30
  def evaluate_response(llm_response):
31
  global client, custom_judge
@@ -58,26 +74,41 @@ with gr.Blocks(theme=gr.themes.Default(primary_hue="blue")) as demo:
58
  show_label=True,
59
  )
60
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
61
  with gr.Row():
62
- # Left column - Judge Creation
63
  with gr.Column():
64
- gr.Markdown("### Create Custom Judge")
65
- judge_name = gr.Textbox(label="👨‍⚖️ Judge Name", placeholder="Enter a name for your custom judge...", interactive=True)
66
- user_intent = gr.Textbox(label="👤 Intent", placeholder="Enter the high-level intent for this judge...", interactive=True)
67
- judge_prompt = gr.Textbox(label="📝 Custom Judge Prompt", placeholder="Enter the custom judge prompt...", interactive=True)
68
- create_judge_btn = gr.Button("✨ CREATE JUDGE", variant="primary")
69
- info_message = gr.Info()
70
-
71
- # Evaluation section (initially hidden)
72
- eval_section = gr.Column(visible=True)
73
- with eval_section:
74
- gr.Markdown("### Evaluate Response")
75
- llm_response = gr.Textbox(label="🤖 LLM Response", placeholder="Enter the LLM response to be evaluated...", interactive=True)
76
- evaluate_btn = gr.Button("🧐 EVALUATE", variant="primary", visible=True)
77
 
78
  # Right column - Results
79
- results_section = gr.Column(visible=True)
80
- with results_section:
81
  score = gr.Textbox(label="📊 Score (between 0 and 1)", interactive=False)
82
  justification = gr.TextArea(label="💬 Justification", interactive=False)
83
 
 
3
 
4
  client = None
5
  custom_judge = None
6
+ MODELS = [
7
+ "claude-3-5-sonnet",
8
+ "claude-3-haiku-20240307",
9
+ "claude-3-opus-20240229",
10
+ "claude-3-sonnet-20240229",
11
+ "codestral",
12
+ "command-r",
13
+ "command-r-plus",
14
+ "fireworks_ai/llama-v3-70b-instruct",
15
+ "gpt-4",
16
+ "gpt-4o",
17
+ "gpt-4o-mini",
18
+ "gpt-4-turbo",
19
+ "groq/llama3-70b-8192",
20
+ "mistral-large-latest",
21
+ "mistral-medium",
22
+ "o1-mini",
23
+ "o1-preview",
24
+ "open-codestral-mamba",
25
+ ]
26
 
27
  def initialize_client(api_key):
28
  global client
 
41
  model="gpt-4o",
42
  )
43
 
44
+ return gr.Info(f"Custom LLM-Judge '{judge_name}' is created successfully!")
 
 
 
 
45
 
46
  def evaluate_response(llm_response):
47
  global client, custom_judge
 
74
  show_label=True,
75
  )
76
 
77
+ gr.Markdown("---") # Divider
78
+
79
+ gr.Markdown("### Create Custom Judge")
80
+ with gr.Row():
81
+ judge_name = gr.Textbox(label="👨‍⚖️ Judge Name", placeholder="Enter a name for your custom judge...", interactive=True)
82
+ user_intent = gr.Textbox(label="👤 Intent", placeholder="Enter the high-level intent for this judge...", interactive=True)
83
+ with gr.Row():
84
+ judge_prompt = gr.Textbox(
85
+ label="📝 Custom Judge Prompt",
86
+ placeholder="Enter the custom judge prompt...",
87
+ interactive=True,
88
+ lines=5,
89
+ max_lines=10
90
+ )
91
+ create_judge_btn = gr.Button("✨ CREATE JUDGE", variant="primary")
92
+ info_message = gr.Info()
93
+
94
+ gr.Markdown("---") # Divider
95
+
96
  with gr.Row():
97
+ # Left column - Evaluation
98
  with gr.Column():
99
+ gr.Markdown("### Evaluate Response")
100
+ llm_response = gr.Textbox(
101
+ label="🤖 LLM Response",
102
+ placeholder="Enter the LLM response to be evaluated...",
103
+ interactive=True,
104
+ lines=5,
105
+ max_lines=10
106
+ )
107
+ evaluate_btn = gr.Button("🧐 EVALUATE", variant="primary", visible=True)
 
 
 
 
108
 
109
  # Right column - Results
110
+ with gr.Column():
111
+ gr.Markdown("### Results")
112
  score = gr.Textbox(label="📊 Score (between 0 and 1)", interactive=False)
113
  justification = gr.TextArea(label="💬 Justification", interactive=False)
114