Kangarroar commited on
Commit
ea4fdfd
1 Parent(s): c01d1a6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -5
app.py CHANGED
@@ -86,11 +86,11 @@ with tempfile.TemporaryDirectory(dir=os.path.expanduser("~/app")) as temp_dir:
86
  # Check if user uploaded a config file
87
  if config is not None:
88
  #TEMP FUNCTION
89
- with tempfile.NamedTemporaryFile(mode="w", suffix='.yaml', delete=False, dir=temp_dir) as temp:
90
- # Get the file contents as a string
91
- str_data = config.read()
92
- # Write the string to the temporary file
93
- temp.write(str_data)
94
  config_temp_file = temp.name
95
  # Print the temporary file name
96
  print(temp.name)
 
86
  # Check if user uploaded a config file
87
  if config is not None:
88
  #TEMP FUNCTION
89
+ with tempfile.NamedTemporaryFile(mode="wb", suffix='.yaml', delete=False) as temp:
90
+ # Get the file contents as bytes
91
+ bytes_data = config.getvalue()
92
+ # Write the bytes to the temporary file
93
+ temp.write(bytes_data)
94
  config_temp_file = temp.name
95
  # Print the temporary file name
96
  print(temp.name)