circulartext commited on
Commit
6f26936
·
verified ·
1 Parent(s): 824a86f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +17 -8
app.py CHANGED
@@ -12,7 +12,7 @@ SPECIAL_WORDS = [
12
  'fruit', 'pineapple', 'milk', 'jello', 'candy', 'rice', 'greens', 'lettuce', 'oatmeal', 'cereal',
13
  'dogs', 'cats', 'animals', 'goats', 'sheep', 'movies', 'money', 'bank', 'account', 'keeping',
14
  'looking', 'moving', 'boxes', 'elephants', 'movement', 'coding', 'developing', 'going', 'cruise',
15
- 'ship', 'boat', 'bahamas', 'foods', 'healthy', 'eating', 'important', 'city', 'ohio',
16
  'north carolina', 'new york', 'france', 'paris', 'work', 'jobs', 'computers', 'computer', 'grocery',
17
  'glamorous', 'version', 'truck', 'pickup', 'play', 'types', 'games', 'applications', 'quantum',
18
  'speeds', 'advancements', 'technological', 'glimpse', 'countless', 'technology', 'future', 'walking',
@@ -26,7 +26,6 @@ SPECIAL_WORDS = [
26
  'track', 'field', 'touchdown', 'basket', 'hope', 'yours', 'thank', 'olympics', 'sports', 'help',
27
  'legal', 'law', 'firm', 'crowd', 'winner', 'winter', 'smoking', 'green', 'purple', 'blue', 'pink',
28
  'orange', 'black', 'white', 'yellow', 'gold', 'weather', 'sun', 'middle', 'summer', 'heat', 'spring'
29
- 'love', 'cars', 'vote', 'super', 'batman', 'superman', 'thor', 'iron man', 'moon', 'mars', 'flying'
30
  ]
31
  # Global variables
32
  initial_word_design = ""
@@ -242,14 +241,24 @@ def process_text(input_text):
242
  return final_output
243
 
244
  def trigger_movement(input_html):
245
- """Function to trigger the movement animation."""
246
  global initial_word_design, special_word
247
-
248
- if not initial_word_design or not special_word:
249
- return input_html
250
 
251
- movement_design = generate_movement_design(special_word)
252
- updated_html = input_html.replace(initial_word_design, movement_design, 1)
 
 
 
 
 
 
 
 
 
 
 
 
 
253
 
254
  return updated_html
255
 
 
12
  'fruit', 'pineapple', 'milk', 'jello', 'candy', 'rice', 'greens', 'lettuce', 'oatmeal', 'cereal',
13
  'dogs', 'cats', 'animals', 'goats', 'sheep', 'movies', 'money', 'bank', 'account', 'keeping',
14
  'looking', 'moving', 'boxes', 'elephants', 'movement', 'coding', 'developing', 'going', 'cruise',
15
+ 'ship', 'boat', 'bahamas', 'foods', 'healthy', 'eating', 'important', 'pennsylvania', 'atlanta',
16
  'north carolina', 'new york', 'france', 'paris', 'work', 'jobs', 'computers', 'computer', 'grocery',
17
  'glamorous', 'version', 'truck', 'pickup', 'play', 'types', 'games', 'applications', 'quantum',
18
  'speeds', 'advancements', 'technological', 'glimpse', 'countless', 'technology', 'future', 'walking',
 
26
  'track', 'field', 'touchdown', 'basket', 'hope', 'yours', 'thank', 'olympics', 'sports', 'help',
27
  'legal', 'law', 'firm', 'crowd', 'winner', 'winter', 'smoking', 'green', 'purple', 'blue', 'pink',
28
  'orange', 'black', 'white', 'yellow', 'gold', 'weather', 'sun', 'middle', 'summer', 'heat', 'spring'
 
29
  ]
30
  # Global variables
31
  initial_word_design = ""
 
241
  return final_output
242
 
243
  def trigger_movement(input_html):
244
+ """Function to trigger the movement animation for all special words."""
245
  global initial_word_design, special_word
 
 
 
246
 
247
+ # Split the input HTML into words
248
+ words = input_html.split()
249
+
250
+ # Iterate over each word and apply movement design if it's a special word
251
+ updated_words = []
252
+ for word in words:
253
+ clean_word = ''.join(filter(str.isalnum, word)).lower()
254
+ if clean_word in SPECIAL_WORDS:
255
+ movement_design = generate_movement_design(clean_word)
256
+ updated_words.append(movement_design)
257
+ else:
258
+ updated_words.append(word)
259
+
260
+ # Join the updated words back into a single HTML string
261
+ updated_html = ' '.join(updated_words)
262
 
263
  return updated_html
264