Spaces:
Runtime error
Runtime error
Create test_api_call.py
Browse files- test_api_call.py +30 -0
test_api_call.py
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from gradio_client import Client, handle_file
|
| 2 |
+
|
| 3 |
+
# Connect to your Space
|
| 4 |
+
client = Client("HolySmokes1234/HolySmokesGenerator")
|
| 5 |
+
|
| 6 |
+
# STEP 1 — Generate the preview
|
| 7 |
+
preview = client.predict(
|
| 8 |
+
img=handle_file("your_photo.png"),
|
| 9 |
+
name="Juan",
|
| 10 |
+
vibe="Saint of Drama",
|
| 11 |
+
color="Divine Gold",
|
| 12 |
+
prop="Candles & Incense",
|
| 13 |
+
sin="Chaos",
|
| 14 |
+
personality="Iconic",
|
| 15 |
+
frame_label="Frame 1",
|
| 16 |
+
remove_bg_flag=True,
|
| 17 |
+
cartoon_flag=False,
|
| 18 |
+
api_name="/update_preview",
|
| 19 |
+
)
|
| 20 |
+
|
| 21 |
+
# STEP 2 — Canonize the preview
|
| 22 |
+
result = client.predict(
|
| 23 |
+
preview_img=preview,
|
| 24 |
+
vibe="Saint of Drama",
|
| 25 |
+
sin="Chaos",
|
| 26 |
+
personality="Iconic",
|
| 27 |
+
api_name="/canonize_ai",
|
| 28 |
+
)
|
| 29 |
+
|
| 30 |
+
print(result)
|