Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -12,6 +12,9 @@ import re
|
|
| 12 |
from markdownify import markdownify
|
| 13 |
from requests.exceptions import RequestException
|
| 14 |
|
|
|
|
|
|
|
|
|
|
| 15 |
@tool
|
| 16 |
def json_string_to_poster(json_string:str)-> str:
|
| 17 |
"""A tool that generate a poster from stringified json object
|
|
@@ -19,14 +22,8 @@ def json_string_to_poster(json_string:str)-> str:
|
|
| 19 |
json_string: stringified json data
|
| 20 |
"""
|
| 21 |
|
| 22 |
-
html_template =
|
| 23 |
-
|
| 24 |
-
<h2>Visualization</h2>
|
| 25 |
-
<p>
|
| 26 |
-
{json_string}
|
| 27 |
-
</p>
|
| 28 |
-
</div>
|
| 29 |
-
"""
|
| 30 |
return html_template
|
| 31 |
|
| 32 |
final_answer = FinalAnswerTool()
|
|
|
|
| 12 |
from markdownify import markdownify
|
| 13 |
from requests.exceptions import RequestException
|
| 14 |
|
| 15 |
+
with open('index.html', 'r', encoding='utf-8') as file:
|
| 16 |
+
cheatsheet_template = file.read()
|
| 17 |
+
|
| 18 |
@tool
|
| 19 |
def json_string_to_poster(json_string:str)-> str:
|
| 20 |
"""A tool that generate a poster from stringified json object
|
|
|
|
| 22 |
json_string: stringified json data
|
| 23 |
"""
|
| 24 |
|
| 25 |
+
html_template = cheatsheet_template.replace('%cheatsheet%', json_string)
|
| 26 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 27 |
return html_template
|
| 28 |
|
| 29 |
final_answer = FinalAnswerTool()
|