ajayspot commited on
Commit
498881e
·
verified ·
1 Parent(s): f7831d4

Upload folder using huggingface_hub

Browse files
Files changed (1) hide show
  1. evaluate_atomic_matching.py +6 -2
evaluate_atomic_matching.py CHANGED
@@ -199,7 +199,8 @@ def process_questions(llm_model: str, openai_api_Key: str, deploy_key: str, metr
199
  pass
200
 
201
  except Exception as e:
202
- return f"Error pushing to repository: {str(e)}", None
 
203
 
204
  # Create Gradio interface
205
  with gr.Blocks(css="footer {visibility: hidden}") as iface:
@@ -256,6 +257,9 @@ with gr.Blocks(css="footer {visibility: hidden}") as iface:
256
  download_btn = gr.Button("Download Results", interactive=False)
257
 
258
  def enable_download(message, filepath):
 
 
 
259
  return message, filepath, gr.Button(value="Download Results", interactive=True)
260
 
261
  process_btn.click(
@@ -270,7 +274,7 @@ with gr.Blocks(css="footer {visibility: hidden}") as iface:
270
  )
271
 
272
  download_btn.click(
273
- fn=lambda filepath: gr.File(value=filepath, label="Download JSON"),
274
  inputs=[file_output],
275
  outputs=gr.File(label="Download JSON")
276
  )
 
199
  pass
200
 
201
  except Exception as e:
202
+ error_message = f"Error pushing to repository: {str(e)}\nResults were saved locally to: {filepath}"
203
+ return error_message, filepath # Return filepath even on git error
204
 
205
  # Create Gradio interface
206
  with gr.Blocks(css="footer {visibility: hidden}") as iface:
 
257
  download_btn = gr.Button("Download Results", interactive=False)
258
 
259
  def enable_download(message, filepath):
260
+ # Only enable download if we have a valid filepath
261
+ if filepath is None:
262
+ return message, None, gr.Button(value="Download Results", interactive=False)
263
  return message, filepath, gr.Button(value="Download Results", interactive=True)
264
 
265
  process_btn.click(
 
274
  )
275
 
276
  download_btn.click(
277
+ fn=lambda filepath: gr.File(value=filepath, label="Download JSON") if filepath else None,
278
  inputs=[file_output],
279
  outputs=gr.File(label="Download JSON")
280
  )