Spaces:
Runtime error
Runtime error
Drew
commited on
Commit
·
88554a6
1
Parent(s):
4e35e69
fix client
Browse files- .gitignore +1 -0
- test_gradio_client.py +2 -25
.gitignore
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
.DS_Store
|
test_gradio_client.py
CHANGED
|
@@ -12,28 +12,5 @@ result = client.predict(
|
|
| 12 |
cfg_scale=7,
|
| 13 |
api_name="/predict"
|
| 14 |
)
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
# Split the path into parts
|
| 20 |
-
parts = result.split(os.sep)
|
| 21 |
-
|
| 22 |
-
# Extract the last two sections
|
| 23 |
-
last_two_sections = os.sep.join(parts[-2:])
|
| 24 |
-
print(last_two_sections)
|
| 25 |
-
|
| 26 |
-
url_root = 'https://dskill-sd-audio.hf.space/file=/tmp/gradio/'
|
| 27 |
-
url = url_root + last_two_sections
|
| 28 |
-
|
| 29 |
-
# Send a GET request to the URL
|
| 30 |
-
response = requests.get(url)
|
| 31 |
-
|
| 32 |
-
# Check if the request was successful
|
| 33 |
-
if response.status_code == 200:
|
| 34 |
-
# Open a file in write-binary mode and write the content of the response to it
|
| 35 |
-
with open('output.wav', 'wb') as file:
|
| 36 |
-
file.write(response.content)
|
| 37 |
-
print('File downloaded successfully!')
|
| 38 |
-
else:
|
| 39 |
-
print('Failed to download the file. Status code:', response.status_code)
|
|
|
|
| 12 |
cfg_scale=7,
|
| 13 |
api_name="/predict"
|
| 14 |
)
|
| 15 |
+
#this is on your local machine wtf wild
|
| 16 |
+
print("result: " + result)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|