Spaces:
Paused
Paused
Update main.py
Browse files
main.py
CHANGED
@@ -1,4 +1,6 @@
|
|
1 |
from fastapi import FastAPI, HTTPException
|
|
|
|
|
2 |
from pydantic import BaseModel
|
3 |
import pickle
|
4 |
import uvicorn
|
@@ -9,7 +11,6 @@ import shutil
|
|
9 |
import subprocess
|
10 |
|
11 |
import torch
|
12 |
-
from flask import Flask, jsonify, request, render_template
|
13 |
from langchain.chains import RetrievalQA
|
14 |
from langchain.embeddings import HuggingFaceInstructEmbeddings
|
15 |
|
@@ -90,6 +91,6 @@ async def predict(data: Predict):
|
|
90 |
(os.path.basename(str(document.metadata["source"])), str(document.page_content))
|
91 |
)
|
92 |
|
93 |
-
return
|
94 |
else:
|
95 |
raise HTTPException(status_code=400, detail="Prompt Incorrect")
|
|
|
1 |
from fastapi import FastAPI, HTTPException
|
2 |
+
from fastapi.staticfiles import StaticFiles
|
3 |
+
|
4 |
from pydantic import BaseModel
|
5 |
import pickle
|
6 |
import uvicorn
|
|
|
11 |
import subprocess
|
12 |
|
13 |
import torch
|
|
|
14 |
from langchain.chains import RetrievalQA
|
15 |
from langchain.embeddings import HuggingFaceInstructEmbeddings
|
16 |
|
|
|
91 |
(os.path.basename(str(document.metadata["source"])), str(document.page_content))
|
92 |
)
|
93 |
|
94 |
+
return prompt_response_dict
|
95 |
else:
|
96 |
raise HTTPException(status_code=400, detail="Prompt Incorrect")
|