Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -1,4 +1,6 @@
|
|
1 |
import streamlit as st
|
|
|
|
|
2 |
import os
|
3 |
from dotenv import load_dotenv
|
4 |
from utils import (
|
@@ -83,14 +85,15 @@ Please apply this analysis to the entire set of documents provided.
|
|
83 |
|
84 |
# Sidebar Configuration
|
85 |
with st.sidebar:
|
86 |
-
st.header("Configuration")
|
87 |
-
api_key = st.text_input(
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
)
|
|
|
92 |
if api_key:
|
93 |
-
configure_gemini(
|
94 |
|
95 |
st.markdown("---")
|
96 |
st.info("""
|
@@ -150,16 +153,19 @@ if uploaded_files and api_key:
|
|
150 |
print(f"DataFrame: {df}")
|
151 |
if not df.empty:
|
152 |
st.dataframe(df)
|
|
|
|
|
|
|
153 |
|
154 |
# Download button
|
155 |
timestamp = datetime.now().strftime("%Y%m%d_%H%M%S")
|
156 |
-
csv_filename = f"{uploaded_file.name}_analysis_{timestamp}.
|
157 |
|
158 |
st.download_button(
|
159 |
label="Download Analysis",
|
160 |
-
data=
|
161 |
file_name=csv_filename,
|
162 |
-
mime="
|
163 |
key=f"download_{i}"
|
164 |
)
|
165 |
else:
|
|
|
1 |
import streamlit as st
|
2 |
+
import pandas as pd
|
3 |
+
from io import BytesIO
|
4 |
import os
|
5 |
from dotenv import load_dotenv
|
6 |
from utils import (
|
|
|
85 |
|
86 |
# Sidebar Configuration
|
87 |
with st.sidebar:
|
88 |
+
# st.header("Configuration")
|
89 |
+
# api_key = st.text_input(
|
90 |
+
# "Enter Gemini API Key:",
|
91 |
+
# type="password",
|
92 |
+
# value=os.getenv("GEMINI_API_KEY", "")
|
93 |
+
# )
|
94 |
+
|
95 |
if api_key:
|
96 |
+
configure_gemini(os.getenv("GEMINI_API_KEY", ""))
|
97 |
|
98 |
st.markdown("---")
|
99 |
st.info("""
|
|
|
153 |
print(f"DataFrame: {df}")
|
154 |
if not df.empty:
|
155 |
st.dataframe(df)
|
156 |
+
xcel_buffer = BytesIO()
|
157 |
+
df.to_excel(excel_buffer, index=False)
|
158 |
+
excel_data = excel_buffer.getvalue()
|
159 |
|
160 |
# Download button
|
161 |
timestamp = datetime.now().strftime("%Y%m%d_%H%M%S")
|
162 |
+
csv_filename = f"{uploaded_file.name}_analysis_{timestamp}.xslx"
|
163 |
|
164 |
st.download_button(
|
165 |
label="Download Analysis",
|
166 |
+
data=excel_data,
|
167 |
file_name=csv_filename,
|
168 |
+
mime="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
169 |
key=f"download_{i}"
|
170 |
)
|
171 |
else:
|