Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
from fastapi import FastAPI, HTTPException
|
2 |
from pydantic import BaseModel
|
3 |
from llama_cpp import Llama
|
4 |
from concurrent.futures import ThreadPoolExecutor, as_completed
|
@@ -147,9 +147,10 @@ async def generate(request: ChatRequest):
|
|
147 |
pass
|
148 |
|
149 |
@app.api_route("/{method_name:path}", methods=["GET", "POST", "PUT", "DELETE", "PATCH"])
|
150 |
-
async def handle_request(method_name: str):
|
151 |
try:
|
152 |
-
|
|
|
153 |
except Exception:
|
154 |
raise HTTPException(status_code=500, detail="Error: Internal Server Error")
|
155 |
|
|
|
1 |
+
from fastapi import FastAPI, HTTPException, Request
|
2 |
from pydantic import BaseModel
|
3 |
from llama_cpp import Llama
|
4 |
from concurrent.futures import ThreadPoolExecutor, as_completed
|
|
|
147 |
pass
|
148 |
|
149 |
@app.api_route("/{method_name:path}", methods=["GET", "POST", "PUT", "DELETE", "PATCH"])
|
150 |
+
async def handle_request(method_name: str, request: Request):
|
151 |
try:
|
152 |
+
body = await request.json()
|
153 |
+
return {"message": "Request handled successfully", "body": body}
|
154 |
except Exception:
|
155 |
raise HTTPException(status_code=500, detail="Error: Internal Server Error")
|
156 |
|