Spaces:
Sleeping
Sleeping
Update main.py
Browse files
main.py
CHANGED
|
@@ -90,6 +90,8 @@ class QueryModel(BaseModel):
|
|
| 90 |
enum=["chat", "report", "report_table"])
|
| 91 |
data_format: str = Query(default="Structured data", description="Type of data to extract from the internet",
|
| 92 |
enum=["No presets", "Structured data", "Quantitative data"])
|
|
|
|
|
|
|
| 93 |
|
| 94 |
@cache(expire=604800)
|
| 95 |
async def generate_report(query: QueryModel):
|
|
@@ -102,7 +104,8 @@ async def generate_report(query: QueryModel):
|
|
| 102 |
data_format = query.data_format
|
| 103 |
optimized_search_query = ""
|
| 104 |
all_text_with_urls = [("", "")]
|
| 105 |
-
|
|
|
|
| 106 |
if query.internet:
|
| 107 |
search_query = re.sub(r'[^\w\s]', '', description).strip()
|
| 108 |
try:
|
|
@@ -123,7 +126,7 @@ async def generate_report(query: QueryModel):
|
|
| 123 |
html_report = md_to_html(md_report)
|
| 124 |
|
| 125 |
# Render Charts
|
| 126 |
-
if has_tables(html_report):
|
| 127 |
print("tables found, creating charts")
|
| 128 |
try:
|
| 129 |
|
|
|
|
| 90 |
enum=["chat", "report", "report_table"])
|
| 91 |
data_format: str = Query(default="Structured data", description="Type of data to extract from the internet",
|
| 92 |
enum=["No presets", "Structured data", "Quantitative data"])
|
| 93 |
+
generate_charts: bool = Query(default=False, description="Include generated charts")
|
| 94 |
+
|
| 95 |
|
| 96 |
@cache(expire=604800)
|
| 97 |
async def generate_report(query: QueryModel):
|
|
|
|
| 104 |
data_format = query.data_format
|
| 105 |
optimized_search_query = ""
|
| 106 |
all_text_with_urls = [("", "")]
|
| 107 |
+
generate_charts = query.generate_charts
|
| 108 |
+
|
| 109 |
if query.internet:
|
| 110 |
search_query = re.sub(r'[^\w\s]', '', description).strip()
|
| 111 |
try:
|
|
|
|
| 126 |
html_report = md_to_html(md_report)
|
| 127 |
|
| 128 |
# Render Charts
|
| 129 |
+
if generate_charts and has_tables(html_report):
|
| 130 |
print("tables found, creating charts")
|
| 131 |
try:
|
| 132 |
|