Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -6,7 +6,7 @@ import requests
|
|
6 |
import os
|
7 |
from transformers import pipeline
|
8 |
import datetime
|
9 |
-
import
|
10 |
|
11 |
# Initialize Summarizer
|
12 |
summarizer = pipeline("summarization", model="facebook/bart-large-cnn")
|
@@ -150,16 +150,16 @@ def stock_research(symbol, assumed_eps=5.0, growth_rate=0.1, book_value=50000000
|
|
150 |
return summary, info_table, ratios_table, sector_comp, fig
|
151 |
|
152 |
def download_report(info_table, ratios_table, sector_comp, summary):
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
return
|
163 |
|
164 |
with gr.Blocks() as iface:
|
165 |
with gr.Row():
|
@@ -197,4 +197,4 @@ with gr.Blocks() as iface:
|
|
197 |
)
|
198 |
|
199 |
if __name__ == "__main__":
|
200 |
-
iface.launch()
|
|
|
6 |
import os
|
7 |
from transformers import pipeline
|
8 |
import datetime
|
9 |
+
import tempfile
|
10 |
|
11 |
# Initialize Summarizer
|
12 |
summarizer = pipeline("summarization", model="facebook/bart-large-cnn")
|
|
|
150 |
return summary, info_table, ratios_table, sector_comp, fig
|
151 |
|
152 |
def download_report(info_table, ratios_table, sector_comp, summary):
|
153 |
+
with tempfile.NamedTemporaryFile(delete=False, suffix=".csv", mode='w') as f:
|
154 |
+
info_table.to_csv(f, index=False)
|
155 |
+
f.write("\n")
|
156 |
+
ratios_table.to_csv(f, index=False)
|
157 |
+
f.write("\n")
|
158 |
+
sector_comp.to_csv(f, index=False)
|
159 |
+
f.write("\nSummary\n")
|
160 |
+
f.write(summary)
|
161 |
+
file_path = f.name
|
162 |
+
return file_path
|
163 |
|
164 |
with gr.Blocks() as iface:
|
165 |
with gr.Row():
|
|
|
197 |
)
|
198 |
|
199 |
if __name__ == "__main__":
|
200 |
+
iface.launch()
|