Spaces:
Sleeping
Sleeping
File size: 1,281 Bytes
86afeab 3194eff 86afeab |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
from fastapi import FastAPI, HTTPException
from fastapi.middleware.cors import CORSMiddleware
import uvicorn
#import nest_asyncio
from pydantic import BaseModel, Field
import json
import pandas as pd
from simple_salesforce import Salesforce
from langchain.chains.question_answering import load_qa_chain
from langchain.llms import OpenAI
from langchain.prompts import PromptTemplate
from langchain.memory import ConversationBufferMemory
from langchain.chat_models import ChatOpenAI
from langchain.chains import RetrievalQA
from langchain.embeddings.openai import OpenAIEmbeddings
from langchain.vectorstores import FAISS
from langchain.document_loaders import DataFrameLoader
import os
app = FastAPI()
origins = ["*"]
app.add_middleware(
CORSMiddleware,
allow_origins=origins,
allow_credentials=True,
allow_methods=["*"],
allow_headers=["*"],
)
@app.get('/')
def index():
return """KnowBot Server running with Salesforce Knowledge Article Data with Generative AI.
Architect : Soumyabrata Das (https://www.linkedin.com/in/soumyabrata-das-b0567b17)
"""
if __name__ == '__main__':
#nest_asyncio.apply()
#uvicorn.run("app:app",host='localhost', port=5000, reload=True)
uvicorn.run(app,host='0.0.0.0', port=5000)
|