Ajaykanth Maddi commited on
Commit
d705a83
·
1 Parent(s): f040c98

Export Button UI Changes

Browse files
Files changed (1) hide show
  1. app.py +2 -36
app.py CHANGED
@@ -225,43 +225,9 @@ def generate_file(subset_dropdown, dataset_type_dropdown,
225
  # Save to file inside Space
226
  with open(fileName, "w") as f:
227
  f.write(json_str)
228
- return json_str, fileName
229
 
230
- def export_data(orig_ans_display,
231
- y_metrics_display,
232
- gen_ans_display,
233
- y_pred_metrics_display,):
234
- """Local file export function that avoids cloud dependencies"""
235
 
236
- import json
237
- print("Exporting data locally...")
238
- try:
239
- # Create timestamped filename
240
- timestamp = datetime.datetime.now().strftime("%Y%m%d_%H%M%S")
241
- filename = f"rag_export_{timestamp}.json"
242
-
243
- # Prepare structured data
244
- export_data = {
245
- "metadata": {
246
- "export_time": timestamp,
247
- "format_version": "1.0"
248
- },
249
- "content": {
250
- "original_answer": orig_ans_display,
251
- "original_metrics": y_metrics_display,
252
- "generated_answer": gen_ans_display,
253
- "prediction_metrics": y_pred_metrics_display,
254
- }
255
- }
256
-
257
- # Save to local JSON file
258
- with open(filename, 'w', encoding='utf-8') as f:
259
- json.dump(export_data, f, indent=2)
260
-
261
- return filename
262
-
263
- except Exception as e:
264
- raise gr.Error(f"Local export failed: {str(e)}")
265
 
266
  def run_rag_pipeline(subset, question, custom_question, chunking, embed_model, retriever, chunk_count, retriever_type,
267
  reranking, evaluator):
@@ -349,7 +315,7 @@ def run_rag_pipeline(subset, question, custom_question, chunking, embed_model, r
349
  json.dumps(y_pred_metrics, indent=2),
350
  formatted_chunks,
351
  json.loads(evaluator_json_output) if evaluator_json_output else {"error": "No evaluation result available."},
352
- {}
353
  )
354
 
355
 
 
225
  # Save to file inside Space
226
  with open(fileName, "w") as f:
227
  f.write(json_str)
 
228
 
229
+ return json_str, fileName
 
 
 
 
230
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
231
 
232
  def run_rag_pipeline(subset, question, custom_question, chunking, embed_model, retriever, chunk_count, retriever_type,
233
  reranking, evaluator):
 
315
  json.dumps(y_pred_metrics, indent=2),
316
  formatted_chunks,
317
  json.loads(evaluator_json_output) if evaluator_json_output else {"error": "No evaluation result available."},
318
+ json.loads("{}")
319
  )
320
 
321