Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -12,12 +12,6 @@ from openai import ChatCompletion
|
|
12 |
from xml.etree import ElementTree as ET
|
13 |
from bs4 import BeautifulSoup
|
14 |
from collections import deque
|
15 |
-
from urllib.parse import quote
|
16 |
-
|
17 |
-
def get_file_content(file_path):
|
18 |
-
with open(file_path, 'r') as file:
|
19 |
-
data = file.read()
|
20 |
-
return data
|
21 |
|
22 |
openai.api_key = os.getenv('OPENAI_KEY')
|
23 |
st.set_page_config(
|
@@ -167,13 +161,9 @@ def main():
|
|
167 |
all_files = glob.glob("*.*")
|
168 |
all_files = sorted(all_files, key=lambda x: (os.path.splitext(x)[1], x)) # sort by file type and file name
|
169 |
for file in all_files:
|
170 |
-
col1,
|
171 |
with col1:
|
172 |
st.markdown(get_table_download_link(file), unsafe_allow_html=True)
|
173 |
-
with col2:
|
174 |
-
if st.button("π", key="browse_"+file):
|
175 |
-
file_content = get_file_content(file)
|
176 |
-
st.text_area("File Content:", file_content, height=100) # Adjust height as needed
|
177 |
with col3:
|
178 |
if st.button("π", key="delete_"+file):
|
179 |
os.remove(file)
|
|
|
12 |
from xml.etree import ElementTree as ET
|
13 |
from bs4 import BeautifulSoup
|
14 |
from collections import deque
|
|
|
|
|
|
|
|
|
|
|
|
|
15 |
|
16 |
openai.api_key = os.getenv('OPENAI_KEY')
|
17 |
st.set_page_config(
|
|
|
161 |
all_files = glob.glob("*.*")
|
162 |
all_files = sorted(all_files, key=lambda x: (os.path.splitext(x)[1], x)) # sort by file type and file name
|
163 |
for file in all_files:
|
164 |
+
col1, col3 = st.sidebar.columns([5,1]) # adjust the ratio as needed
|
165 |
with col1:
|
166 |
st.markdown(get_table_download_link(file), unsafe_allow_html=True)
|
|
|
|
|
|
|
|
|
167 |
with col3:
|
168 |
if st.button("π", key="delete_"+file):
|
169 |
os.remove(file)
|