gospacedev commited on
Commit
63600f6
1 Parent(s): 420df50

update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -0
app.py CHANGED
@@ -21,6 +21,11 @@ def generate_translation(prompt):
21
  stream = client.text_generation(
22
  formatted_prompt, **generate_kwargs, stream=True, details=True, return_full_text=False)
23
  output = ""
 
 
 
 
 
24
  emoji_pattern = r"[^\u0021-\u007E\u00A0-\uD7FF\uE000-\uFDCF\uFF00-\uFFEF\u10000-\u10FFFF\u0300-\u036F\u1F00-\u1F1F\u1F20-\u1F7F\u2600-\u26FF\u2700-\u27BF]+?"
25
 
26
  filtered_output = re.findall(emoji_pattern, output)
 
21
  stream = client.text_generation(
22
  formatted_prompt, **generate_kwargs, stream=True, details=True, return_full_text=False)
23
  output = ""
24
+
25
+ for response in stream:
26
+ output += response.token.text
27
+ yield output
28
+
29
  emoji_pattern = r"[^\u0021-\u007E\u00A0-\uD7FF\uE000-\uFDCF\uFF00-\uFFEF\u10000-\u10FFFF\u0300-\u036F\u1F00-\u1F1F\u1F20-\u1F7F\u2600-\u26FF\u2700-\u27BF]+?"
30
 
31
  filtered_output = re.findall(emoji_pattern, output)