Update handler.py
Browse files- handler.py +12 -12
handler.py
CHANGED
|
@@ -3,7 +3,7 @@ import logging
|
|
| 3 |
import torch
|
| 4 |
import soundfile as sf
|
| 5 |
from transformers import AutoTokenizer, AutoModelForTextToWaveform
|
| 6 |
-
import cloudinary.uploader
|
| 7 |
import tkinter as tk
|
| 8 |
from tkinter import ttk
|
| 9 |
import pygame
|
|
@@ -35,21 +35,21 @@ class EndpointHandler():
|
|
| 35 |
|
| 36 |
# Save the audio to a file
|
| 37 |
sf.write("StoryAudio.wav", outputs["waveform"][0].numpy(), self.model.config.sampling_rate)
|
| 38 |
-
uploadGraphFile("StoryAudio.wav")
|
| 39 |
playAudioFile()
|
| 40 |
#return 'StoryAudio.wav'
|
| 41 |
# Check if the request was successful
|
| 42 |
|
| 43 |
-
def uploadGraphFile(fileName):
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
|
| 54 |
def play_audio():
|
| 55 |
pygame.mixer.music.load("StoryAudio.wav")
|
|
|
|
| 3 |
import torch
|
| 4 |
import soundfile as sf
|
| 5 |
from transformers import AutoTokenizer, AutoModelForTextToWaveform
|
| 6 |
+
#import cloudinary.uploader
|
| 7 |
import tkinter as tk
|
| 8 |
from tkinter import ttk
|
| 9 |
import pygame
|
|
|
|
| 35 |
|
| 36 |
# Save the audio to a file
|
| 37 |
sf.write("StoryAudio.wav", outputs["waveform"][0].numpy(), self.model.config.sampling_rate)
|
| 38 |
+
#uploadGraphFile("StoryAudio.wav")
|
| 39 |
playAudioFile()
|
| 40 |
#return 'StoryAudio.wav'
|
| 41 |
# Check if the request was successful
|
| 42 |
|
| 43 |
+
# def uploadGraphFile(fileName):
|
| 44 |
+
# # Configure Cloudinary credentials
|
| 45 |
+
# cloudinary.config(
|
| 46 |
+
# cloud_name = "dm9tdqvp6",
|
| 47 |
+
# api_key ="793865869491345",
|
| 48 |
+
# api_secret = "0vhdvBoM35IWcO29NyI04Qj1PMo"
|
| 49 |
+
# )
|
| 50 |
+
# # Upload a file to Cloudinary
|
| 51 |
+
# result = cloudinary.uploader.upload(fileName, folder="poc-graph", resource_type="raw")
|
| 52 |
+
# return result
|
| 53 |
|
| 54 |
def play_audio():
|
| 55 |
pygame.mixer.music.load("StoryAudio.wav")
|