Commit
·
e2c50b4
1
Parent(s):
cf2717b
Update app.py
Browse files
app.py
CHANGED
|
@@ -93,15 +93,18 @@ def calculate(image_in, audio_in):
|
|
| 93 |
waveform, sample_rate = torchaudio.load(audio_in)
|
| 94 |
waveform = torch.mean(waveform, dim=0, keepdim=True)
|
| 95 |
torchaudio.save("/content/audio.wav", waveform, sample_rate, encoding="PCM_S", bits_per_sample=16)
|
|
|
|
|
|
|
| 96 |
print(f" *#*#*# original image => {image_in} *#*#*# ")
|
| 97 |
if os.path.exists(image_in):
|
|
|
|
| 98 |
image = Image.open(image_in)
|
| 99 |
else:
|
| 100 |
print("image not exists reading web image")
|
| 101 |
image_url = "http://labelme.csail.mit.edu/Release3.0/Images/users/DNguyen91/face/m_unsexy_gr.jpg"
|
| 102 |
response = requests.get(image_url)
|
| 103 |
image = Image.open(BytesIO(response.content))
|
| 104 |
-
|
| 105 |
image = pad_image(image)
|
| 106 |
# os.system(f"rm -rf /content/image.png")
|
| 107 |
image.save("image.png")
|
|
|
|
| 93 |
waveform, sample_rate = torchaudio.load(audio_in)
|
| 94 |
waveform = torch.mean(waveform, dim=0, keepdim=True)
|
| 95 |
torchaudio.save("/content/audio.wav", waveform, sample_rate, encoding="PCM_S", bits_per_sample=16)
|
| 96 |
+
image_in = image_in.replace("results/", "")
|
| 97 |
+
print("****"*100)
|
| 98 |
print(f" *#*#*# original image => {image_in} *#*#*# ")
|
| 99 |
if os.path.exists(image_in):
|
| 100 |
+
print(f"image exists => {image_in}")
|
| 101 |
image = Image.open(image_in)
|
| 102 |
else:
|
| 103 |
print("image not exists reading web image")
|
| 104 |
image_url = "http://labelme.csail.mit.edu/Release3.0/Images/users/DNguyen91/face/m_unsexy_gr.jpg"
|
| 105 |
response = requests.get(image_url)
|
| 106 |
image = Image.open(BytesIO(response.content))
|
| 107 |
+
print("****"*100)
|
| 108 |
image = pad_image(image)
|
| 109 |
# os.system(f"rm -rf /content/image.png")
|
| 110 |
image.save("image.png")
|