coeuslearning commited on
Commit
b470587
1 Parent(s): e3382f4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -5
app.py CHANGED
@@ -71,10 +71,11 @@ def generate(
71
  outputs = []
72
  for text in streamer:
73
  outputs.append(text)
74
- # Mask the output here
75
- masked_output = mask_with_protecto("".join(outputs))
76
- # yield "".join(outputs)
77
- yield masked_output
 
78
 
79
 
80
  def mask_with_protecto(text_for_prompt):
@@ -95,7 +96,7 @@ def mask_with_protecto(text_for_prompt):
95
  # Parse the masked result from the API response and format it for display
96
  masked_result = response.json()
97
  final_result = json.dumps(masked_result, indent=4)
98
- return_value = str(masked_result["data"][0]["token_value"])
99
  return(return_value)
100
  else:
101
  # Return an error message if the API request was not successful.
 
71
  outputs = []
72
  for text in streamer:
73
  outputs.append(text)
74
+ concatenated_outputs = " ".join(outputs)
75
+ #yield concatenated_outputs
76
+
77
+ # Mask the output here
78
+ masked_output = mask_with_protecto(concatenated_outputs)
79
 
80
 
81
  def mask_with_protecto(text_for_prompt):
 
96
  # Parse the masked result from the API response and format it for display
97
  masked_result = response.json()
98
  final_result = json.dumps(masked_result, indent=4)
99
+ return_value = str(masked_result)
100
  return(return_value)
101
  else:
102
  # Return an error message if the API request was not successful.