mike dupont commited on
Commit
51877c2
1 Parent(s): 06731e2

fixing download

Browse files
Files changed (1) hide show
  1. app.py +9 -26
app.py CHANGED
@@ -2,6 +2,7 @@ import streamlit as st
2
  import pandas as pd
3
  import numpy as np
4
  import os
 
5
  from glob import glob
6
  import subprocess
7
 
@@ -50,7 +51,7 @@ model = st.selectbox("model", ["mistral","mixtral"])
50
  input_dir = st.selectbox("Select a file", files)
51
  st.write(f"You selected file: {input_dir}")
52
 
53
- if st.button("Process data"):
54
  prompt = prompt.replace("\"","\'")
55
  cmd = ["bash",
56
  "./run_agent.sh",
@@ -96,29 +97,10 @@ def get_out_files(path='.'):
96
  return files
97
 
98
 
99
- if st.button(f"Scan output {input_dir}"):
100
- st.write('Going to scan')
101
- outfiles = get_out_files(input_dir)
102
- if len(outfiles) > limit:
103
- outfiles = outfiles[0:limit]
104
- #st.write(outfiles)
105
-
106
- for x in outfiles:
107
- if os.path.isdir(x):
108
- pass
109
- else:
110
- (p,f) =os.path.split(x)
111
- with open(x, "r") as fp:
112
- btn = st.download_button(
113
- label="Download text" + f,
114
- data=fp,
115
- file_name=f,
116
- mime="application/text"
117
- )
118
-
119
- ###
120
 
121
- def get_out_files(path='.'):
 
 
122
  """Recursive function to find all files in given directory path."""
123
  files = []
124
  for item in os.listdir(path):
@@ -135,8 +117,8 @@ if st.button(f"Scan output {input_dir}"):
135
  pass
136
  return files
137
 
138
-
139
- if st.button(f"Scan output {input_dir}"):
140
  st.write('Going to scan')
141
  outfiles = get_out_files(input_dir)
142
  if len(outfiles) > limit:
@@ -150,7 +132,8 @@ if st.button(f"Scan output {input_dir}"):
150
  (p,f) =os.path.split(x)
151
  with open(x, "r") as fp:
152
  btn = st.download_button(
153
- label="Download text" + f,
 
154
  data=fp,
155
  file_name=f,
156
  mime="application/text"
 
2
  import pandas as pd
3
  import numpy as np
4
  import os
5
+ import sys
6
  from glob import glob
7
  import subprocess
8
 
 
51
  input_dir = st.selectbox("Select a file", files)
52
  st.write(f"You selected file: {input_dir}")
53
 
54
+ if st.button("Process data",key="process"):
55
  prompt = prompt.replace("\"","\'")
56
  cmd = ["bash",
57
  "./run_agent.sh",
 
97
  return files
98
 
99
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
100
 
101
+ ### output
102
+
103
+ def get_out_files(path='.'):
104
  """Recursive function to find all files in given directory path."""
105
  files = []
106
  for item in os.listdir(path):
 
117
  pass
118
  return files
119
 
120
+ # scan1
121
+ if st.button(f"Scan output {input_dir}", key=input_dir):
122
  st.write('Going to scan')
123
  outfiles = get_out_files(input_dir)
124
  if len(outfiles) > limit:
 
132
  (p,f) =os.path.split(x)
133
  with open(x, "r") as fp:
134
  btn = st.download_button(
135
+ key=x,
136
+ label="Download text" + x,
137
  data=fp,
138
  file_name=f,
139
  mime="application/text"