deveix commited on
Commit
1a102e1
β€’
1 Parent(s): f6f901a

copy files outside

Browse files
app/main.py CHANGED
@@ -2,7 +2,7 @@ from fastapi import FastAPI, HTTPException, Header, Depends
2
  from pydantic import BaseModel
3
  import os
4
  from pymongo import MongoClient
5
- from langchain.embeddings import SentenceTransformerEmbeddings
6
  from langchain_community.vectorstores import MongoDBAtlasVectorSearch
7
  import uvicorn
8
  from dotenv import load_dotenv
@@ -99,13 +99,13 @@ async def get_answer(item: Item, token: str = Depends(verify_token)):
99
  clean_answers = [doc.page_content.replace("\n", " ").strip() for doc in matching_docs]
100
 
101
  # Assuming 'search_file.txt' is where we want to search answers
102
- answers_index = index_file('./dataset/quran_tafseer_formatted.txt')
103
 
104
  # Collect line numbers based on answers found
105
  line_numbers = [answers_index[answer] for answer in clean_answers if answer in answers_index]
106
 
107
  # Assuming 'retrieve_file.txt' is where we retrieve lines based on line numbers
108
- result_text = get_text_by_line_number('./dataset/quran_tafseer.txt', line_numbers)
109
 
110
  return {"result_text": result_text}
111
  except Exception as e:
 
2
  from pydantic import BaseModel
3
  import os
4
  from pymongo import MongoClient
5
+ from langchain_community.embeddings import SentenceTransformerEmbeddings
6
  from langchain_community.vectorstores import MongoDBAtlasVectorSearch
7
  import uvicorn
8
  from dotenv import load_dotenv
 
99
  clean_answers = [doc.page_content.replace("\n", " ").strip() for doc in matching_docs]
100
 
101
  # Assuming 'search_file.txt' is where we want to search answers
102
+ answers_index = index_file('quran_tafseer_formatted.txt')
103
 
104
  # Collect line numbers based on answers found
105
  line_numbers = [answers_index[answer] for answer in clean_answers if answer in answers_index]
106
 
107
  # Assuming 'retrieve_file.txt' is where we retrieve lines based on line numbers
108
+ result_text = get_text_by_line_number('quran_tafseer.txt', line_numbers)
109
 
110
  return {"result_text": result_text}
111
  except Exception as e:
app/{dataset/quran_tafseer.txt β†’ quran_tafseer.txt} RENAMED
File without changes
app/{dataset/quran_tafseer_formatted.txt β†’ quran_tafseer_formatted.txt} RENAMED
File without changes