awacke1 commited on
Commit
c94d18a
·
verified ·
1 Parent(s): b6bf02e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -19
app.py CHANGED
@@ -223,12 +223,10 @@ def SpeechSynthesis(result):
223
  components.html(documentHTML5, width=1280, height=300)
224
 
225
 
226
- # 9. Sidebar with UI controls to review and re-run prompts and continue responses
227
  @st.cache_resource
228
  def get_table_download_link(file_path):
229
  with open(file_path, 'r') as file:
230
  data = file.read()
231
-
232
  b64 = base64.b64encode(data.encode()).decode()
233
  file_name = os.path.basename(file_path)
234
  ext = os.path.splitext(file_name)[1] # get the file extension
@@ -252,6 +250,21 @@ def get_table_download_link(file_path):
252
  return href
253
 
254
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
255
 
256
  def FileSidebar():
257
  # ----------------------------------------------------- File Sidebar for Jump Gates ------------------------------------------
@@ -924,23 +937,6 @@ def divide_prompt(prompt, max_length):
924
  return chunks
925
 
926
 
927
- # 13. Provide way of saving all and deleting all to give way of reviewing output and saving locally before clearing it
928
-
929
- @st.cache_resource
930
- def create_zip_of_files(files):
931
- zip_name = "all_files.zip"
932
- with zipfile.ZipFile(zip_name, 'w') as zipf:
933
- for file in files:
934
- zipf.write(file)
935
- return zip_name
936
-
937
- @st.cache_resource
938
- def get_zip_download_link(zip_file):
939
- with open(zip_file, 'rb') as f:
940
- data = f.read()
941
- b64 = base64.b64encode(data).decode()
942
- href = f'<a href="data:application/zip;base64,{b64}" download="{zip_file}">Download All</a>'
943
- return href
944
 
945
  API_URL_IE = f'https://tonpixzfvq3791u9.us-east-1.aws.endpoints.huggingface.cloud'
946
  API_URL_IE = "https://api-inference.huggingface.co/models/openai/whisper-small.en"
 
223
  components.html(documentHTML5, width=1280, height=300)
224
 
225
 
 
226
  @st.cache_resource
227
  def get_table_download_link(file_path):
228
  with open(file_path, 'r') as file:
229
  data = file.read()
 
230
  b64 = base64.b64encode(data.encode()).decode()
231
  file_name = os.path.basename(file_path)
232
  ext = os.path.splitext(file_name)[1] # get the file extension
 
250
  return href
251
 
252
 
253
+ @st.cache_resource
254
+ def create_zip_of_files(files): # ----------------------------------
255
+ zip_name = "all_files.zip"
256
+ with zipfile.ZipFile(zip_name, 'w') as zipf:
257
+ for file in files:
258
+ zipf.write(file)
259
+ return zip_name
260
+ @st.cache_resource
261
+ def get_zip_download_link(zip_file):
262
+ with open(zip_file, 'rb') as f:
263
+ data = f.read()
264
+ b64 = base64.b64encode(data).decode()
265
+ href = f'<a href="data:application/zip;base64,{b64}" download="{zip_file}">Download All</a>'
266
+ return href # ----------------------------------
267
+
268
 
269
  def FileSidebar():
270
  # ----------------------------------------------------- File Sidebar for Jump Gates ------------------------------------------
 
937
  return chunks
938
 
939
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
940
 
941
  API_URL_IE = f'https://tonpixzfvq3791u9.us-east-1.aws.endpoints.huggingface.cloud'
942
  API_URL_IE = "https://api-inference.huggingface.co/models/openai/whisper-small.en"