ThongAccount commited on
Commit ·
c452930
1
Parent(s): deb83c9
dwasdwdasdw
Browse files- .gitignore +0 -1
- README.md +4 -4
- app.py +0 -31
- structures.json +0 -74
.gitignore
DELETED
|
@@ -1 +0,0 @@
|
|
| 1 |
-
pusher.py
|
|
|
|
|
|
README.md
CHANGED
|
@@ -1,8 +1,8 @@
|
|
| 1 |
---
|
| 2 |
-
title:
|
| 3 |
-
emoji:
|
| 4 |
-
colorFrom:
|
| 5 |
-
colorTo:
|
| 6 |
sdk: docker
|
| 7 |
pinned: false
|
| 8 |
license: gemma
|
|
|
|
| 1 |
---
|
| 2 |
+
title: Minecraft Ai Builder Backend
|
| 3 |
+
emoji: 📉
|
| 4 |
+
colorFrom: green
|
| 5 |
+
colorTo: pink
|
| 6 |
sdk: docker
|
| 7 |
pinned: false
|
| 8 |
license: gemma
|
app.py
CHANGED
|
@@ -23,34 +23,3 @@ class Structure(BaseModel):
|
|
| 23 |
def generate(prompt: Prompt):
|
| 24 |
result = generate_structure(prompt.text)
|
| 25 |
return {"response": result}
|
| 26 |
-
|
| 27 |
-
@app.post("/register_structure")
|
| 28 |
-
def register_structure(structure: Structure):
|
| 29 |
-
# Load existing structures
|
| 30 |
-
structures = []
|
| 31 |
-
if os.path.exists(STRUCTURE_FILE):
|
| 32 |
-
with open(STRUCTURE_FILE, "r") as f:
|
| 33 |
-
try:
|
| 34 |
-
structures = json.load(f)
|
| 35 |
-
except json.JSONDecodeError:
|
| 36 |
-
pass # File was empty or invalid
|
| 37 |
-
|
| 38 |
-
# Check for duplicates
|
| 39 |
-
for s in structures:
|
| 40 |
-
if s["name"] == structure.name:
|
| 41 |
-
raise HTTPException(status_code=400, detail="Structure with this name already exists")
|
| 42 |
-
|
| 43 |
-
# Append and save
|
| 44 |
-
structures.append(structure.dict())
|
| 45 |
-
with open(STRUCTURE_FILE, "w") as f:
|
| 46 |
-
json.dump(structures, f, indent=2)
|
| 47 |
-
|
| 48 |
-
return {"message": "Structure registered successfully"}
|
| 49 |
-
|
| 50 |
-
@app.get("/structures", response_class=HTMLResponse)
|
| 51 |
-
def list_structures():
|
| 52 |
-
html = "<h2>Registered Structures</h2><table border='1'><tr><th>Name</th><th>Description</th><th>Required Blocks</th><th>Tags</th></tr>"
|
| 53 |
-
for structure in structure_store:
|
| 54 |
-
html += f"<tr><td>{structure.name}</td><td>{structure.description}</td><td>{', '.join(structure.required_blocks)}</td><td>{', '.join(structure.tags)}</td></tr>"
|
| 55 |
-
html += "</table>"
|
| 56 |
-
return html
|
|
|
|
| 23 |
def generate(prompt: Prompt):
|
| 24 |
result = generate_structure(prompt.text)
|
| 25 |
return {"response": result}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
structures.json
DELETED
|
@@ -1,74 +0,0 @@
|
|
| 1 |
-
[
|
| 2 |
-
{
|
| 3 |
-
"name": "castle_tower",
|
| 4 |
-
"description": "A medieval tower with battlements and defensive height.",
|
| 5 |
-
"required_blocks": ["stone_bricks", "cobblestone", "mossy_stone_bricks", "oak_planks", "torch"],
|
| 6 |
-
"tags": ["medieval", "defense"]
|
| 7 |
-
},
|
| 8 |
-
{
|
| 9 |
-
"name": "underground_bunker",
|
| 10 |
-
"description": "A secure underground base with reinforced walls and redstone lighting.",
|
| 11 |
-
"required_blocks": ["obsidian", "iron_block", "redstone_lamp", "lever", "smooth_stone"],
|
| 12 |
-
"tags": ["underground", "modern"]
|
| 13 |
-
},
|
| 14 |
-
{
|
| 15 |
-
"name": "treehouse",
|
| 16 |
-
"description": "A cozy elevated structure built into a tree canopy.",
|
| 17 |
-
"required_blocks": ["oak_logs", "oak_planks", "leaves", "ladder", "glass_pane"],
|
| 18 |
-
"tags": ["nature", "elevated"]
|
| 19 |
-
},
|
| 20 |
-
{
|
| 21 |
-
"name": "desert_hut",
|
| 22 |
-
"description": "A simple shelter for desert biomes.",
|
| 23 |
-
"required_blocks": ["sandstone", "smooth_sandstone", "cut_sandstone", "oak_door", "torch"],
|
| 24 |
-
"tags": ["desert", "village"]
|
| 25 |
-
},
|
| 26 |
-
{
|
| 27 |
-
"name": "ice_temple",
|
| 28 |
-
"description": "A mystical temple made from packed ice and glowing blocks.",
|
| 29 |
-
"required_blocks": ["packed_ice", "blue_ice", "snow_block", "sea_lantern", "light_blue_stained_glass"],
|
| 30 |
-
"tags": ["frozen", "temple"]
|
| 31 |
-
},
|
| 32 |
-
{
|
| 33 |
-
"name": "sky_platform",
|
| 34 |
-
"description": "A suspended platform in the sky, usable as base foundation.",
|
| 35 |
-
"required_blocks": ["stone_slab", "glass", "iron_block", "torch", "scaffolding"],
|
| 36 |
-
"tags": ["sky", "platform"]
|
| 37 |
-
},
|
| 38 |
-
{
|
| 39 |
-
"name": "nether_watchtower",
|
| 40 |
-
"description": "A watchtower adapted for survival in the Nether.",
|
| 41 |
-
"required_blocks": ["nether_bricks", "red_nether_bricks", "soul_torch", "basalt", "iron_bars"],
|
| 42 |
-
"tags": ["nether", "fortification"]
|
| 43 |
-
},
|
| 44 |
-
{
|
| 45 |
-
"name": "floating_island",
|
| 46 |
-
"description": "A small magical floating island with vegetation.",
|
| 47 |
-
"required_blocks": ["grass_block", "dirt", "leaves", "oak_logs", "glowstone"],
|
| 48 |
-
"tags": ["floating", "fantasy"]
|
| 49 |
-
},
|
| 50 |
-
{
|
| 51 |
-
"name": "library_room",
|
| 52 |
-
"description": "An interior room filled with books and study space.",
|
| 53 |
-
"required_blocks": ["bookshelf", "oak_planks", "lantern", "glass_pane", "carpet"],
|
| 54 |
-
"tags": ["indoor", "library"]
|
| 55 |
-
},
|
| 56 |
-
{
|
| 57 |
-
"name": "farm_stable",
|
| 58 |
-
"description": "A small stable and feeding zone for animals.",
|
| 59 |
-
"required_blocks": ["hay_block", "fence", "oak_planks", "coarse_dirt", "torch"],
|
| 60 |
-
"tags": ["farm", "animals"]
|
| 61 |
-
},
|
| 62 |
-
{
|
| 63 |
-
"name": "swamp_shack",
|
| 64 |
-
"description": "A mossy shack on stilts above swampy water.",
|
| 65 |
-
"required_blocks": ["mossy_cobblestone", "spruce_planks", "vines", "lily_pad", "oak_trapdoor"],
|
| 66 |
-
"tags": ["swamp", "shack"]
|
| 67 |
-
},
|
| 68 |
-
{
|
| 69 |
-
"name": "mine_entrance",
|
| 70 |
-
"description": "A small cave entrance with support beams and torches.",
|
| 71 |
-
"required_blocks": ["stone", "oak_logs", "rails", "torch", "gravel"],
|
| 72 |
-
"tags": ["mining", "cave"]
|
| 73 |
-
}
|
| 74 |
-
]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|