ouhenio commited on
Commit
2ba8eb9
·
verified ·
1 Parent(s): bcd0e3c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -1
app.py CHANGED
@@ -246,6 +246,9 @@ with gr.Blocks(theme=gr.themes.Soft(primary_hue="pink", secondary_hue="purple"))
246
 
247
  # Button to generate new random data
248
  def update_data():
 
 
 
249
  # Create new random percentages
250
  new_data = {
251
  code: {"name": data["name"], "percent": random.randint(10, 90)}
@@ -253,7 +256,6 @@ with gr.Blocks(theme=gr.themes.Soft(primary_hue="pink", secondary_hue="purple"))
253
  }
254
 
255
  # Update the global variable
256
- global COUNTRY_DATA
257
  COUNTRY_DATA = new_data
258
 
259
  # Return the updated script
 
246
 
247
  # Button to generate new random data
248
  def update_data():
249
+ # Declare the variable as global first
250
+ global COUNTRY_DATA
251
+
252
  # Create new random percentages
253
  new_data = {
254
  code: {"name": data["name"], "percent": random.randint(10, 90)}
 
256
  }
257
 
258
  # Update the global variable
 
259
  COUNTRY_DATA = new_data
260
 
261
  # Return the updated script