max-long commited on
Commit
75c03f0
·
verified ·
1 Parent(s): c09c624

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -2
app.py CHANGED
@@ -101,8 +101,9 @@ with gr.Blocks(title="Textile Machinery NER Demo") as demo:
101
  sample = next(dataset_iter)['text']
102
  return sample
103
  except StopIteration:
104
- break
105
- return "No more snippets available."
 
106
 
107
  # Connect refresh button
108
  refresh_btn.click(fn=get_new_snippet, outputs=input_text)
 
101
  sample = next(dataset_iter)['text']
102
  return sample
103
  except StopIteration:
104
+ break # Exit the loop if we run out of snippets
105
+ attempts += 1 # Increment attempts
106
+ return "No more snippets available." # Return this if no valid snippets are found
107
 
108
  # Connect refresh button
109
  refresh_btn.click(fn=get_new_snippet, outputs=input_text)