Spaces:
Running
Running
Sigrid De los Santos
commited on
Commit
Β·
8143a2a
1
Parent(s):
bb235fc
Remove remaining binary file for Hugging Face
Browse files- app.py +11 -3
- src/main.py +3 -1
app.py
CHANGED
@@ -48,15 +48,23 @@ if submitted:
|
|
48 |
df.to_csv(tmp_csv.name, index=False)
|
49 |
csv_path = tmp_csv.name
|
50 |
|
51 |
-
|
52 |
log_output = st.empty()
|
53 |
string_buffer = StringIO()
|
54 |
|
55 |
-
|
|
|
|
|
|
|
|
|
|
|
56 |
output_path = run_pipeline(csv_path, tavily_api_key)
|
|
|
57 |
|
58 |
logs = string_buffer.getvalue()
|
59 |
-
|
|
|
|
|
60 |
|
61 |
if output_path and isinstance(output_path, list):
|
62 |
st.success("β
Analysis complete!")
|
|
|
48 |
df.to_csv(tmp_csv.name, index=False)
|
49 |
csv_path = tmp_csv.name
|
50 |
|
51 |
+
progress_placeholder = st.empty()
|
52 |
log_output = st.empty()
|
53 |
string_buffer = StringIO()
|
54 |
|
55 |
+
def write_log(msg):
|
56 |
+
print(msg) # Will go to final log
|
57 |
+
progress_placeholder.markdown(f"π {msg}")
|
58 |
+
|
59 |
+
with contextlib.redirect_stdout(string_buffer):
|
60 |
+
write_log("π Starting analysis...")
|
61 |
output_path = run_pipeline(csv_path, tavily_api_key)
|
62 |
+
write_log("β
Finished analysis.")
|
63 |
|
64 |
logs = string_buffer.getvalue()
|
65 |
+
progress_placeholder.empty() # Clear ephemeral log
|
66 |
+
log_output.code(logs) # Show final full log
|
67 |
+
|
68 |
|
69 |
if output_path and isinstance(output_path, list):
|
70 |
st.success("β
Analysis complete!")
|
src/main.py
CHANGED
@@ -60,7 +60,9 @@ def run_value_investing_analysis(csv_path):
|
|
60 |
from image_search import search_unsplash_image
|
61 |
|
62 |
# Later inside your loop
|
63 |
-
image_url, image_credit = search_unsplash_image(topic
|
|
|
|
|
64 |
|
65 |
metrics_md = build_metrics_box(topic, len(news))
|
66 |
full_md = metrics_md + report_body
|
|
|
60 |
from image_search import search_unsplash_image
|
61 |
|
62 |
# Later inside your loop
|
63 |
+
image_url, image_credit = search_unsplash_image(topic)
|
64 |
+
|
65 |
+
#image_url, image_credit = search_unsplash_image(topic, os.getenv("OPENAI_API_KEY"))
|
66 |
|
67 |
metrics_md = build_metrics_box(topic, len(news))
|
68 |
full_md = metrics_md + report_body
|