Spaces:
Sleeping
Sleeping
crislmfroes
commited on
Commit
•
4501353
1
Parent(s):
44d6125
Change upload folder
Browse files
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'
|
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'
|
49 |
-
agent.run(f"Uploaded:
|
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)
|