Commit
·
231cb7b
1
Parent(s):
072df7d
- .gitignore +1 -1
- app.py +5 -19
- requirements.txt +0 -3
- tester.py +4 -2
.gitignore
CHANGED
|
@@ -1 +1 @@
|
|
| 1 |
-
|
|
|
|
| 1 |
+
tester.py
|
app.py
CHANGED
|
@@ -1,25 +1,11 @@
|
|
| 1 |
-
import
|
| 2 |
-
import os
|
| 3 |
-
from typing import List
|
| 4 |
-
from fastapi import FastAPI, HTTPException
|
| 5 |
-
from fastapi.responses import HTMLResponse
|
| 6 |
from pydantic import BaseModel
|
| 7 |
-
from model import generate_structure
|
| 8 |
|
| 9 |
app = FastAPI()
|
| 10 |
-
STRUCTURE_FILE = "structures.json"
|
| 11 |
-
structure_store = []
|
| 12 |
|
| 13 |
-
class
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
class Structure(BaseModel):
|
| 17 |
-
name: str
|
| 18 |
-
description: str
|
| 19 |
-
required_blocks: List[str]
|
| 20 |
-
tags: List[str]
|
| 21 |
|
| 22 |
@app.post("/prompt")
|
| 23 |
-
async def
|
| 24 |
-
|
| 25 |
-
return {"response": result}
|
|
|
|
| 1 |
+
from fastapi import FastAPI
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
from pydantic import BaseModel
|
|
|
|
| 3 |
|
| 4 |
app = FastAPI()
|
|
|
|
|
|
|
| 5 |
|
| 6 |
+
class PromptRequest(BaseModel):
|
| 7 |
+
prompt: str
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
|
| 9 |
@app.post("/prompt")
|
| 10 |
+
async def handle_prompt(request: PromptRequest):
|
| 11 |
+
return {"message": f"Prompt received: {request.prompt}"}
|
|
|
requirements.txt
CHANGED
|
@@ -1,5 +1,2 @@
|
|
| 1 |
fastapi
|
| 2 |
uvicorn
|
| 3 |
-
llama-cpp-python==0.2.72 # prebuilt versions now available from PyPI
|
| 4 |
-
python-dotenv
|
| 5 |
-
huggingface_hub
|
|
|
|
| 1 |
fastapi
|
| 2 |
uvicorn
|
|
|
|
|
|
|
|
|
tester.py
CHANGED
|
@@ -15,8 +15,10 @@ Only return a valid JSON structure named `layout`. No explanation or extra text.
|
|
| 15 |
|
| 16 |
|
| 17 |
response = requests.post(
|
| 18 |
-
"http://thongcoder-minecraft-ai-builder-backend.hf.space/
|
| 19 |
-
json={"prompt": prompt}
|
|
|
|
|
|
|
| 20 |
)
|
| 21 |
|
| 22 |
print(response.status_code)
|
|
|
|
| 15 |
|
| 16 |
|
| 17 |
response = requests.post(
|
| 18 |
+
url="http://thongcoder-minecraft-ai-builder-backend.hf.space/prompt",
|
| 19 |
+
json={"prompt": prompt},
|
| 20 |
+
headers={"Content-Type": 'application/json',
|
| 21 |
+
'accept': 'application/json'}
|
| 22 |
)
|
| 23 |
|
| 24 |
print(response.status_code)
|