Spaces:
Build error
Build error
Delete app.py
Browse files
app.py
DELETED
|
@@ -1,105 +0,0 @@
|
|
| 1 |
-
import gradio as gr
|
| 2 |
-
import requests
|
| 3 |
-
import json
|
| 4 |
-
from typing import Dict, Any
|
| 5 |
-
|
| 6 |
-
SPACE_URL = "https://huggingface.co/spaces/NexaCoders/NexaClothes"
|
| 7 |
-
|
| 8 |
-
# ๐ฅ SEXY PRESETS
|
| 9 |
-
PRESETS = {
|
| 10 |
-
"๐ฅ Slutty": {
|
| 11 |
-
"top": "sheer_top_white", "bra": None, "boobs": "nipple_show",
|
| 12 |
-
"bottom": "thong_visible", "shoes": "heels_red"
|
| 13 |
-
},
|
| 14 |
-
"๐ Bikini": {
|
| 15 |
-
"top": "bikini_top_red", "bra": "pushup_black", "boobs": "visible",
|
| 16 |
-
"bottom": "miniskirt_black", "shoes": "sandals_strappy"
|
| 17 |
-
},
|
| 18 |
-
"๐ Crop Top": {
|
| 19 |
-
"top": "crop_top_pink", "bra": "lace_pink", "boobs": "enhanced",
|
| 20 |
-
"bottom": "hotpants_denim", "shoes": "platforms"
|
| 21 |
-
}
|
| 22 |
-
}
|
| 23 |
-
|
| 24 |
-
def get_outfit(user_id: str = "Nexa") -> str:
|
| 25 |
-
try:
|
| 26 |
-
r = requests.get(f"{SPACE_URL}/api/avatar/{user_id}", timeout=10)
|
| 27 |
-
return json.dumps(r.json(), indent=2)
|
| 28 |
-
except:
|
| 29 |
-
return "โ API Error - Check server"
|
| 30 |
-
|
| 31 |
-
def change_clothes(user_id: str, category: str, item: str) -> str:
|
| 32 |
-
try:
|
| 33 |
-
r = requests.patch(
|
| 34 |
-
f"{SPACE_URL}/api/avatar/{user_id}/clothes/{category}",
|
| 35 |
-
json={"item": item},
|
| 36 |
-
timeout=10
|
| 37 |
-
)
|
| 38 |
-
return json.dumps(r.json(), indent=2)
|
| 39 |
-
except Exception as e:
|
| 40 |
-
return f"โ Error: {str(e)}"
|
| 41 |
-
|
| 42 |
-
def load_preset(user_id: str, preset: str) -> str:
|
| 43 |
-
try:
|
| 44 |
-
preset_data = PRESETS[preset]
|
| 45 |
-
r = requests.put(f"{SPACE_URL}/api/avatar/{user_id}", json=preset_data, timeout=10)
|
| 46 |
-
return json.dumps(r.json(), indent=2)
|
| 47 |
-
except:
|
| 48 |
-
return "โ Preset Error"
|
| 49 |
-
|
| 50 |
-
# GRADIO UI
|
| 51 |
-
with gr.Blocks(
|
| 52 |
-
title="๐ฅ NexaClothes - Sexy Avatar API",
|
| 53 |
-
theme=gr.themes.Soft()
|
| 54 |
-
) as demo:
|
| 55 |
-
|
| 56 |
-
gr.Markdown("""
|
| 57 |
-
# ๐ **NexaClothes API** - 200+ Sexy Clothes
|
| 58 |
-
Change avatar outfits instantly! **LIVE API**
|
| 59 |
-
""")
|
| 60 |
-
|
| 61 |
-
with gr.Tabs():
|
| 62 |
-
with gr.TabItem("๐ฎ Quick Change"):
|
| 63 |
-
with gr.Row():
|
| 64 |
-
with gr.Column(scale=1):
|
| 65 |
-
user_id = gr.Textbox("Nexa", label="๐ค User ID")
|
| 66 |
-
category = gr.Dropdown(
|
| 67 |
-
choices=list(CLOTHES.keys()),
|
| 68 |
-
value="top",
|
| 69 |
-
label="๐ Category"
|
| 70 |
-
)
|
| 71 |
-
item_input = gr.Textbox(label="๐ Item Name")
|
| 72 |
-
change_btn = gr.Button("๐ CHANGE CLOTHES", variant="primary", scale=2)
|
| 73 |
-
|
| 74 |
-
result = gr.JSON(label="๐ Current Outfit")
|
| 75 |
-
|
| 76 |
-
gr.Examples([
|
| 77 |
-
["Nexa", "top", "sheer_top_white"],
|
| 78 |
-
["Nexa", "bra", "null"],
|
| 79 |
-
["Nexa", "boobs", "nipple_show"],
|
| 80 |
-
["Nexa", "bottom", "thong_visible"]
|
| 81 |
-
], [user_id, category, item_input], fn=change_clothes, outputs=result)
|
| 82 |
-
|
| 83 |
-
with gr.TabItem("โจ Presets"):
|
| 84 |
-
with gr.Row():
|
| 85 |
-
preset_user = gr.Textbox("Nexa", label="User ID")
|
| 86 |
-
presets = gr.Dropdown(list(PRESETS.keys()), label="Choose Look")
|
| 87 |
-
preset_btn = gr.Button("๐จ LOAD PRESET", variant="primary")
|
| 88 |
-
preset_result = gr.JSON(label="Outfit Loaded")
|
| 89 |
-
|
| 90 |
-
preset_btn.click(load_preset, [preset_user, presets], preset_result)
|
| 91 |
-
|
| 92 |
-
with gr.TabItem("๐ API Test"):
|
| 93 |
-
gr.Markdown("""
|
| 94 |
-
```
|
| 95 |
-
GET /api/avatar/Nexa
|
| 96 |
-
PATCH /api/avatar/Nexa/clothes/top {"item": "bikini_top_red"}
|
| 97 |
-
POST /api/avatar/Nexa/random
|
| 98 |
-
```
|
| 99 |
-
""")
|
| 100 |
-
api_test = gr.Button("๐งช Test API Health")
|
| 101 |
-
api_result = gr.JSON(value="Click to test!")
|
| 102 |
-
|
| 103 |
-
# Launch
|
| 104 |
-
if __name__ == "__main__":
|
| 105 |
-
demo.launch(server_name="0.0.0.0", server_port=7861)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|