Update app.py
Browse files
app.py
CHANGED
|
@@ -280,6 +280,11 @@ def run_preprocessing(args):
|
|
| 280 |
|
| 281 |
return preprocessed_data
|
| 282 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 283 |
@app.route("/run", methods=['POST'])
|
| 284 |
def generate_video():
|
| 285 |
global start_time
|
|
@@ -333,6 +338,7 @@ def generate_video():
|
|
| 333 |
try:
|
| 334 |
data = json.loads(json_data)
|
| 335 |
text_prompt = data.get('content')
|
|
|
|
| 336 |
app.config['text_prompt'] = text_prompt
|
| 337 |
end_time_ryze = time.time()
|
| 338 |
diff = end_time_ryze - start_time_ryze
|
|
|
|
| 280 |
|
| 281 |
return preprocessed_data
|
| 282 |
|
| 283 |
+
def remove_brackets(text):
|
| 284 |
+
# Use regex to remove content in brackets at the end of the text
|
| 285 |
+
cleaned_text = re.sub(r'\s*\[.*?\]\s*$', '', text)
|
| 286 |
+
return cleaned_text.strip()
|
| 287 |
+
|
| 288 |
@app.route("/run", methods=['POST'])
|
| 289 |
def generate_video():
|
| 290 |
global start_time
|
|
|
|
| 338 |
try:
|
| 339 |
data = json.loads(json_data)
|
| 340 |
text_prompt = data.get('content')
|
| 341 |
+
text_prompt = remove_brackets(text_prompt)
|
| 342 |
app.config['text_prompt'] = text_prompt
|
| 343 |
end_time_ryze = time.time()
|
| 344 |
diff = end_time_ryze - start_time_ryze
|