Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -7,6 +7,7 @@ import json
|
|
| 7 |
import time
|
| 8 |
|
| 9 |
API_URL = os.environ.get("API_URL")
|
|
|
|
| 10 |
supported_languages = ['zh', 'en']
|
| 11 |
|
| 12 |
output_dir = 'outputs'
|
|
@@ -103,7 +104,12 @@ def predict(prompt, style, audio_file_pth, agree):
|
|
| 103 |
|
| 104 |
start = time.time()
|
| 105 |
# Send the data as a POST request
|
| 106 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 107 |
print(f'Get response successfully within {time.time() - start}')
|
| 108 |
|
| 109 |
# Check the response
|
|
|
|
| 7 |
import time
|
| 8 |
|
| 9 |
API_URL = os.environ.get("API_URL")
|
| 10 |
+
TOKEN = os.environ.get("TOKEN")
|
| 11 |
supported_languages = ['zh', 'en']
|
| 12 |
|
| 13 |
output_dir = 'outputs'
|
|
|
|
| 104 |
|
| 105 |
start = time.time()
|
| 106 |
# Send the data as a POST request
|
| 107 |
+
|
| 108 |
+
headers = {
|
| 109 |
+
"Authorization": f"Bearer {TOKEN}"
|
| 110 |
+
}
|
| 111 |
+
|
| 112 |
+
response = requests.post(API_URL, json=data, headers=headers, timeout=60)
|
| 113 |
print(f'Get response successfully within {time.time() - start}')
|
| 114 |
|
| 115 |
# Check the response
|