Peter commited on
Commit
11da24b
1 Parent(s): 571c966

:sparkles: add sharing for local testing

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -128,15 +128,15 @@ def load_uploaded_file(file_obj):
128
  str, the uploaded file contents
129
  """
130
 
131
- file_path = Path(file_obj[0].name)
132
 
133
  try:
134
- with open(file_path, "r", encoding="utf-8", errors="ignore") as f:
135
  raw_text = f.read()
136
  text = clean(raw_text, lower=False)
137
  return text
138
  except Exception as e:
139
- logging.info(f"Trying to load file with path {file_path}, error: {e}")
140
  return "Error: Could not read file. Ensure that it is a valid text file with encoding UTF-8."
141
 
142
 
@@ -248,7 +248,7 @@ if __name__ == "__main__":
248
  )
249
 
250
  load_file_button.click(
251
- fn=load_uploaded_file, inputs=[uploaded_file], outputs=[input_text]
252
  )
253
 
254
  summarize_button.click(
 
128
  str, the uploaded file contents
129
  """
130
 
131
+ # file_path = Path(file_obj[0].name)
132
 
133
  try:
134
+ with open(file_obj, "r", encoding="utf-8", errors="ignore") as f:
135
  raw_text = f.read()
136
  text = clean(raw_text, lower=False)
137
  return text
138
  except Exception as e:
139
+ logging.info(f"Trying to load file with path {file_obj}, error: {e}")
140
  return "Error: Could not read file. Ensure that it is a valid text file with encoding UTF-8."
141
 
142
 
 
248
  )
249
 
250
  load_file_button.click(
251
+ fn=load_uploaded_file, inputs=uploaded_file, outputs=[input_text]
252
  )
253
 
254
  summarize_button.click(