Spaces:
Sleeping
Sleeping
update model
Browse filesFiles changed (6)
- .gitignore+3-1
- Dockerfile+8-10
- app.py+2-2
- requirements.txt+1-1
- src/helper.py+1-1
- store_index.pyAdded+39
209 unmodified lines210211212213209 unmodified lines# Virtual environments created by tools like venv, virtualenv, or conda.# These directories contain the Python interpreter and installed packages, which are not needed# in version control.medchatbot/209 unmodified lines210211212213214215209 unmodified lines# Virtual environments created by tools like venv, virtualenv, or conda.# These directories contain the Python interpreter and installed packages, which are not needed# in version control.medchatbot2/research/Data/
3 unmodified lines456789101112131415161718192021222324252627283 unmodified linesWORKDIR /app# Copy dependenciesCOPY requirements.txt setup.py ./# dependenciesRUN pip install --no-cache-dir -r requirements.txt# cache directory for Hugging FaceENV HF_HOME=/app/.cache#RUN mkdir -p /app/.cache && chmod -R 777 /app/.cache# Pre-download model (sentence-transformers/all-MiniLM-L6-v2)RUN python -c "from sentence_transformers import SentenceTransformer; SentenceTransformer('sentence-transformers/all-MiniLM-L6-v2')"#COPY . .#EXPOSE 7860# Run appCMD ["python", "app.py"]3 unmodified lines45678910111213141516171819202122232425263 unmodified linesWORKDIR /app# Copy dependenciesCOPY requirements.txt ./# Install dependenciesRUN pip install --no-cache-dir -r requirements.txt# Hugging Face cache directoryENV HF_HOME=/app/.cacheRUN mkdir -p /app/.cache && chmod -R 777 /app/.cache# Pre-download model to cacheRUN python -c "from sentence_transformers import SentenceTransformer; SentenceTransformer('sentence-transformers/all-MiniLM-L6-v2')"# Copy rest of the projectCOPY . .# Expose the port expected by HF SpacesEXPOSE 8080# Run appCMD ["python", "app.py"]
32 unmodified lines3334353637383923 unmodified lines6364656632 unmodified linesretriever = docsearch.as_retriever(search_type="similarity", search_kwargs={"k":3})llm = ChatGoogleGenerativeAI(model="gemini-2.5-pro",google_api_key=GEMINI_API_KEY,temperature=0.4,max_output_tokens=204823 unmodified linesreturn str(response["answer"])if __name__ == '__main__':app.run(host="0.0.0.0", port= 7860, debug= True)32 unmodified lines3334353637383923 unmodified lines6364656632 unmodified linesretriever = docsearch.as_retriever(search_type="similarity", search_kwargs={"k":3})llm = ChatGoogleGenerativeAI(model="gemini-2.0-flash-lite",google_api_key=GEMINI_API_KEY,temperature=0.4,max_output_tokens=204823 unmodified linesreturn str(response["answer"])if __name__ == '__main__':app.run(host="0.0.0.0", port= 8080, debug= True)
6 unmodified lines789101112136 unmodified lineslangchain-pineconelangchain_communitylangchain_openailangchain-huggingfacelangchain_experimentallangchain_google_genai-e .6 unmodified lines789101112136 unmodified lineslangchain-pineconelangchain_communitylangchain_openailangchain_experimentallangchain_google_genailangchain-huggingface-e .
1234from langchain_community.document_loaders import PyPDFLoader, DirectoryLoaderfrom langchain.text_splitter import RecursiveCharacterTextSplitterfrom langchain_huggingface import HuggingFaceEmbeddings1234from langchain_community.document_loaders import DirectoryLoader, PyPDFLoaderfrom langchain.text_splitter import RecursiveCharacterTextSplitterfrom langchain_huggingface import HuggingFaceEmbeddings
123456789101112131415161718192021222324252627282930313233343536373839from src.helper import load_pdf_file, text_split, download_hugging_face_embeddingsfrom pinecone.grpc import PineconeGRPC as Pineconefrom pinecone import ServerlessSpecfrom langchain_pinecone import PineconeVectorStorefrom dotenv import load_dotenvimport os
load_dotenv()
PINECONE_API_KEY=os.environ.get('PINECONE_API_KEY')os.environ["PINECONE_API_KEY"] = PINECONE_API_KEY
extracted_data=load_pdf_file(data='Data/')text_chunks=text_split(extracted_data)embeddings = download_hugging_face_embeddings()
pc = Pinecone(api_key=PINECONE_API_KEY)
index_name = "medchatbot"
pc.create_index( name=index_name, dimension=384, metric="cosine", spec=ServerlessSpec( cloud="aws", region="us-east-1" ) )
# Embed each chunk and upsert the embeddings into your Pinecone index.docsearch = PineconeVectorStore.from_documents( documents=text_chunks, index_name=index_name, embedding=embeddings, )
.gitignore+3-1
Dockerfile+8-10
app.py+2-2
requirements.txt+1-1
src/helper.py+1-1
store_index.pyAdded+39