GeorgeSherif commited on
Commit
d34d332
·
1 Parent(s): 508e6cb
Files changed (1) hide show
  1. app.py +2 -1
app.py CHANGED
@@ -65,6 +65,8 @@ def get_next_image(session_data):
65
 
66
  # Function to save the annotation to the Hugging Face dataset and fetch the next image
67
  def save_annotation(caption, session_data):
 
 
68
  if session_data["current_image"] is None:
69
  return gr.update(visible=False), gr.update(value="All images have been annotated!")
70
 
@@ -89,7 +91,6 @@ def save_annotation(caption, session_data):
89
  "annotation_count": [annotation_count + 1]
90
  })
91
 
92
- global dataset
93
  dataset = concatenate_datasets([dataset, new_data])
94
 
95
  # Save updated dataset to Hugging Face
 
65
 
66
  # Function to save the annotation to the Hugging Face dataset and fetch the next image
67
  def save_annotation(caption, session_data):
68
+ global dataset # Declare global at the start of the function
69
+
70
  if session_data["current_image"] is None:
71
  return gr.update(visible=False), gr.update(value="All images have been annotated!")
72
 
 
91
  "annotation_count": [annotation_count + 1]
92
  })
93
 
 
94
  dataset = concatenate_datasets([dataset, new_data])
95
 
96
  # Save updated dataset to Hugging Face