Spaces:
Runtime error
Runtime error
Drew
commited on
Commit
·
4e35e69
1
Parent(s):
cb32d8a
token
Browse files- test_gradio_client.py +8 -4
test_gradio_client.py
CHANGED
|
@@ -1,10 +1,12 @@
|
|
| 1 |
-
from gradio_client import Client
|
| 2 |
import requests
|
| 3 |
import os
|
| 4 |
|
| 5 |
-
|
|
|
|
|
|
|
| 6 |
result = client.predict(
|
| 7 |
-
prompt="Ambient
|
| 8 |
seconds_total=5,
|
| 9 |
steps=100,
|
| 10 |
cfg_scale=7,
|
|
@@ -12,6 +14,8 @@ result = client.predict(
|
|
| 12 |
)
|
| 13 |
print(result)
|
| 14 |
|
|
|
|
|
|
|
| 15 |
# Split the path into parts
|
| 16 |
parts = result.split(os.sep)
|
| 17 |
|
|
@@ -19,7 +23,7 @@ parts = result.split(os.sep)
|
|
| 19 |
last_two_sections = os.sep.join(parts[-2:])
|
| 20 |
print(last_two_sections)
|
| 21 |
|
| 22 |
-
url_root = 'https://
|
| 23 |
url = url_root + last_two_sections
|
| 24 |
|
| 25 |
# Send a GET request to the URL
|
|
|
|
| 1 |
+
from gradio_client import Client, file
|
| 2 |
import requests
|
| 3 |
import os
|
| 4 |
|
| 5 |
+
HF_TOKEN = os.getenv('HF_TOKEN')
|
| 6 |
+
|
| 7 |
+
client = Client("dskill/sd-audio", hf_token=HF_TOKEN, download_files=True)
|
| 8 |
result = client.predict(
|
| 9 |
+
prompt="Ambient rainfall",
|
| 10 |
seconds_total=5,
|
| 11 |
steps=100,
|
| 12 |
cfg_scale=7,
|
|
|
|
| 14 |
)
|
| 15 |
print(result)
|
| 16 |
|
| 17 |
+
|
| 18 |
+
|
| 19 |
# Split the path into parts
|
| 20 |
parts = result.split(os.sep)
|
| 21 |
|
|
|
|
| 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
|