Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -381,6 +381,37 @@ Required keys:
|
|
| 381 |
"url":"https://url.source"
|
| 382 |
"""
|
| 383 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 384 |
def save_memory(purpose, history):
|
| 385 |
uid=uuid.uuid4()
|
| 386 |
history=str(history)
|
|
@@ -425,6 +456,7 @@ def save_memory(purpose, history):
|
|
| 425 |
task=task,
|
| 426 |
history=hist,
|
| 427 |
).strip('\n')
|
|
|
|
| 428 |
#new_history = resp
|
| 429 |
#print (resp)
|
| 430 |
#out+=resp
|
|
|
|
| 381 |
"url":"https://url.source"
|
| 382 |
"""
|
| 383 |
|
| 384 |
+
def format_json(inp):
|
| 385 |
+
new_json=[]
|
| 386 |
+
print("FORMATTING:::")
|
| 387 |
+
for i,line in inp:
|
| 388 |
+
if line.strip().startswith(("keywords","title","description","content","url","{","}")):
|
| 389 |
+
print (line)
|
| 390 |
+
|
| 391 |
+
'''
|
| 392 |
+
print (f'NEW LINE:: {line}')
|
| 393 |
+
if line.startswith("keywords"):
|
| 394 |
+
keywords_val = line.split(":")[1]
|
| 395 |
+
if line.startswith("title"):
|
| 396 |
+
title_val = line.split(":")[1]
|
| 397 |
+
if line.startswith("description"):
|
| 398 |
+
description_val = line.split(":")[1]
|
| 399 |
+
if line.startswith("content"):
|
| 400 |
+
content_val = line.split(":")[1]
|
| 401 |
+
if line.startswith("url"):
|
| 402 |
+
url_val = line.split(":")[1]
|
| 403 |
+
|
| 404 |
+
"keywords": ["texas", "news", "breaking", "houston", "dallas", "shooting"],
|
| 405 |
+
"title": "Breaking News from CBS11 - CBS Texas",
|
| 406 |
+
"description": "The latest news and headlines from CBS Texas.",
|
| 407 |
+
"content": "CBS Texas provides the latest news and headlines. The source url is https://www.cbsnews.com/texas/local-news/",
|
| 408 |
+
"url": "http
|
| 409 |
+
'''
|
| 410 |
+
|
| 411 |
+
|
| 412 |
+
#if line.startswith()
|
| 413 |
+
|
| 414 |
+
|
| 415 |
def save_memory(purpose, history):
|
| 416 |
uid=uuid.uuid4()
|
| 417 |
history=str(history)
|
|
|
|
| 456 |
task=task,
|
| 457 |
history=hist,
|
| 458 |
).strip('\n')
|
| 459 |
+
format_json(resp)
|
| 460 |
#new_history = resp
|
| 461 |
#print (resp)
|
| 462 |
#out+=resp
|