crislmfroes commited on
Commit
4501353
1 Parent(s): 44d6125

Change upload folder

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -41,12 +41,12 @@ def on_user_message(contents, user, instance):
41
  if file_input.value is not None:
42
  if file_input.filename.endswith((".png", ".jpg", ".jpeg")):
43
  filename = str(uuid4())+".png"
44
- Image.open(contents).save(f'./uploads/{filename}')
45
  elif file_input.filename.endswith((".mp3", ".wav")):
46
  filename = str(uuid4())+".wav"
47
  audio, rate = a2n.audio_from_file(contents)
48
- scipy.io.wavfile.write(f'./uploads/{filename}', rate, audio)
49
- agent.run(f"Uploaded: ./uploads/{filename}")
50
  file_input.value = None
51
  else:
52
  agent.run(contents)
 
41
  if file_input.value is not None:
42
  if file_input.filename.endswith((".png", ".jpg", ".jpeg")):
43
  filename = str(uuid4())+".png"
44
+ Image.open(contents).save(f'/tmp/{filename}')
45
  elif file_input.filename.endswith((".mp3", ".wav")):
46
  filename = str(uuid4())+".wav"
47
  audio, rate = a2n.audio_from_file(contents)
48
+ scipy.io.wavfile.write(f'/tmp/{filename}', rate, audio)
49
+ agent.run(f"Uploaded: /tmp/{filename}")
50
  file_input.value = None
51
  else:
52
  agent.run(contents)