Spaces:
Runtime error
Runtime error
Update main.py
Browse files
main.py
CHANGED
@@ -1,4 +1,7 @@
|
|
1 |
from fastapi import FastAPI, Request, HTTPException
|
|
|
|
|
|
|
2 |
from langchain.document_loaders import WebBaseLoader
|
3 |
from langchain.chains.summarize import load_summarize_chain
|
4 |
#https://python.langchain.com/docs/use_cases/summarization
|
@@ -28,6 +31,7 @@ chain = load_summarize_chain(llm, chain_type="refine")
|
|
28 |
app = FastAPI()
|
29 |
class ChatRequest(BaseModel):
|
30 |
target_url: str
|
|
|
31 |
|
32 |
@app.post('/')
|
33 |
async def home_api(request: Request):
|
|
|
1 |
from fastapi import FastAPI, Request, HTTPException
|
2 |
+
from fastapi.responses import JSONResponse
|
3 |
+
from pydantic import BaseModel
|
4 |
+
|
5 |
from langchain.document_loaders import WebBaseLoader
|
6 |
from langchain.chains.summarize import load_summarize_chain
|
7 |
#https://python.langchain.com/docs/use_cases/summarization
|
|
|
31 |
app = FastAPI()
|
32 |
class ChatRequest(BaseModel):
|
33 |
target_url: str
|
34 |
+
#似乎必须要有这个class定义???
|
35 |
|
36 |
@app.post('/')
|
37 |
async def home_api(request: Request):
|