Spaces:
Sleeping
Sleeping
Ryan
commited on
Commit
·
43b87f7
1
Parent(s):
f81bb08
update
Browse files
app.py
CHANGED
@@ -72,17 +72,6 @@ def create_app():
|
|
72 |
# Add a state for storing user dataset analysis results
|
73 |
user_analysis_log = gr.State({})
|
74 |
|
75 |
-
# Create the summary components at the top level so they can be referenced by all tabs
|
76 |
-
summary_content = gr.Textbox(
|
77 |
-
label="Summary Content",
|
78 |
-
lines=25,
|
79 |
-
max_lines=50,
|
80 |
-
interactive=False,
|
81 |
-
visible=False # Initially hidden
|
82 |
-
)
|
83 |
-
|
84 |
-
summary_status = gr.Markdown("", visible=False) # Initially hidden
|
85 |
-
|
86 |
# Dataset Input Tab
|
87 |
with gr.Tab("Dataset Input"):
|
88 |
# Filter out files that start with 'summary' for the Dataset Input tab
|
@@ -103,7 +92,7 @@ def create_app():
|
|
103 |
# Save dataset to state and update status
|
104 |
def create_dataset(p, r1, m1, r2, m2):
|
105 |
if not p or not r1 or not r2:
|
106 |
-
return {}, "❌ **Error:** Please fill in at least the prompt and both responses"
|
107 |
|
108 |
dataset = {
|
109 |
"entries": [
|
@@ -111,14 +100,12 @@ def create_app():
|
|
111 |
{"prompt": p, "response": r2, "model": m2 or "Model 2"}
|
112 |
]
|
113 |
}
|
114 |
-
|
115 |
-
# Return the dataset and a success message
|
116 |
-
return dataset, f"Dataset created successfully with prompt: '{p[:50]}...'", "", "**New dataset created. Previous analysis results cleared.**"
|
117 |
|
118 |
create_btn.click(
|
119 |
fn=create_dataset,
|
120 |
inputs=[prompt, response1, model1, response2, model2],
|
121 |
-
outputs=[dataset_state, dataset_status
|
122 |
)
|
123 |
|
124 |
# Analysis Tab
|
@@ -979,7 +966,7 @@ def create_app():
|
|
979 |
)
|
980 |
|
981 |
load_summary_btn = gr.Button("Load Summary", variant="primary")
|
982 |
-
|
983 |
summary_assistant_prompt = gr.Textbox(
|
984 |
value="Attached are the results from various NLP based comparisons between two LLM responses on the same prompt. Give your interpretation of the results.",
|
985 |
label="Analysis Assistant Prompt",
|
@@ -988,9 +975,14 @@ def create_app():
|
|
988 |
)
|
989 |
|
990 |
with gr.Column(scale=3):
|
991 |
-
|
992 |
-
|
993 |
-
|
|
|
|
|
|
|
|
|
|
|
994 |
|
995 |
# Function to load summary content from file or user analysis
|
996 |
def load_summary_content(file_name, user_log):
|
@@ -1189,7 +1181,7 @@ def create_app():
|
|
1189 |
inputs=[summary_dropdown, user_analysis_log],
|
1190 |
outputs=[summary_content, summary_status]
|
1191 |
)
|
1192 |
-
|
1193 |
with gr.Tab("Visuals"):
|
1194 |
gr.Markdown("## Visualization Graphs")
|
1195 |
|
|
|
72 |
# Add a state for storing user dataset analysis results
|
73 |
user_analysis_log = gr.State({})
|
74 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
75 |
# Dataset Input Tab
|
76 |
with gr.Tab("Dataset Input"):
|
77 |
# Filter out files that start with 'summary' for the Dataset Input tab
|
|
|
92 |
# Save dataset to state and update status
|
93 |
def create_dataset(p, r1, m1, r2, m2):
|
94 |
if not p or not r1 or not r2:
|
95 |
+
return {}, "❌ **Error:** Please fill in at least the prompt and both responses"
|
96 |
|
97 |
dataset = {
|
98 |
"entries": [
|
|
|
100 |
{"prompt": p, "response": r2, "model": m2 or "Model 2"}
|
101 |
]
|
102 |
}
|
103 |
+
return dataset, "✅ **Dataset created successfully!** You can now go to the Analysis tab"
|
|
|
|
|
104 |
|
105 |
create_btn.click(
|
106 |
fn=create_dataset,
|
107 |
inputs=[prompt, response1, model1, response2, model2],
|
108 |
+
outputs=[dataset_state, dataset_status]
|
109 |
)
|
110 |
|
111 |
# Analysis Tab
|
|
|
966 |
)
|
967 |
|
968 |
load_summary_btn = gr.Button("Load Summary", variant="primary")
|
969 |
+
|
970 |
summary_assistant_prompt = gr.Textbox(
|
971 |
value="Attached are the results from various NLP based comparisons between two LLM responses on the same prompt. Give your interpretation of the results.",
|
972 |
label="Analysis Assistant Prompt",
|
|
|
975 |
)
|
976 |
|
977 |
with gr.Column(scale=3):
|
978 |
+
summary_content = gr.Textbox(
|
979 |
+
label="Summary Content",
|
980 |
+
lines=25,
|
981 |
+
max_lines=50,
|
982 |
+
interactive=False
|
983 |
+
)
|
984 |
+
|
985 |
+
summary_status = gr.Markdown("*No summary loaded*")
|
986 |
|
987 |
# Function to load summary content from file or user analysis
|
988 |
def load_summary_content(file_name, user_log):
|
|
|
1181 |
inputs=[summary_dropdown, user_analysis_log],
|
1182 |
outputs=[summary_content, summary_status]
|
1183 |
)
|
1184 |
+
# Add a Visuals tab for plotting graphs
|
1185 |
with gr.Tab("Visuals"):
|
1186 |
gr.Markdown("## Visualization Graphs")
|
1187 |
|