Skip to content

Commit d9020f8

Browse files
cluster_qns api done
1 parent 1f852c3 commit d9020f8

File tree

7 files changed

+23
-8
lines changed

7 files changed

+23
-8
lines changed

Backend/Generate_qns.py

Whitespace-only changes.
607 Bytes
Binary file not shown.

Backend/cluster_qns.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
from fastapi import APIRouter, Response
2+
from pathlib import Path
3+
4+
router = APIRouter()
5+
6+
@router.get("/clusterqns")
7+
async def generate_file():
8+
# Read the content of the file from local storage
9+
file_path = "Local_Storage/Generated_Files/cluster_questions.txt" # Replace with the actual path to your local file
10+
with open(file_path, "r") as file:
11+
file_content = file.read()
12+
13+
# Set the response to download the file
14+
return Response(content=file_content, media_type="text/plain")

Backend/pyqsorter.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#pyqsorter , sorts set of pyqs into modules
2-
from fastapi import APIRouter
2+
from fastapi import APIRouter, Response
33
import os
44
import re
55
import chardet
@@ -9,6 +9,7 @@
99
from sklearnex import patch_sklearn
1010
patch_sklearn()
1111
from sklearn.cluster import KMeans
12+
from pathlib import path
1213

1314

1415

Python_Code/Generate_qns.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,11 @@
55

66

77
# Define your input parameters
8-
with open('#define path sorted questions here', 'r') as file:
9-
sorted_questions = str(file.read())
10-
with open('#define path notebook questions here', 'r') as file:
11-
notebook_questions = str(file.read())
8+
with open('Local_Storage/Generated_Files/cluster_questions.txt', 'r') as file:
9+
sorted_questions = str(file.read())
1210
with open('#define path for important topics here', 'r') as file:
1311
important_topics = str(file.read())
14-
with open('#define path for reference paper here', 'r', encoding='latin-1') as file:
12+
with open('Local_Storage/pyqs_text', 'r', encoding='latin-1') as file:
1513
reference_paper = str(file.read())
1614

1715

__pycache__/main.cpython-310.pyc

-4 Bytes
Binary file not shown.

main.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
#from Backend.summariser import router as api2_router
55
#from Backend.Notes_Analyser import router as api4_router
66
#from Backend.Narrator import router as api5_router
7-
from Backend.NotesToText import router as NotesToText_rounter
7+
#from Backend.NotesToText import router as NotesToText_rounter
8+
from Backend.cluster_qns import router as cluster_qns_app
89
# import other API routers as needed
910

1011
app = FastAPI()
@@ -17,7 +18,8 @@
1718
#app.include_router(api5_router)
1819
# include other API routers as needed
1920

20-
app.include_router(NotesToText_rounter)
21+
#app.include_router(NotesToText_rounter)
22+
app.include_router(cluster_qns_app)
2123

2224
if __name__ == "__main__":
2325
uvicorn.run(app, host="0.0.0.0", port=8000)

0 commit comments

Comments
 (0)