Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
cv_filter_tool
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Lokesh Singh
cv_filter_tool
Commits
4380067b
Commit
4380067b
authored
Jan 18, 2025
by
LSING46
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
main file added
parent
e1b793f0
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
35 additions
and
0 deletions
+35
-0
api.py
src/api.py
+24
-0
main.py
src/main.py
+10
-0
requirements.txt
src/requirements.txt
+1
-0
No files found.
src/api.py
0 → 100644
View file @
4380067b
from
fastapi
import
APIRouter
,
HTTPException
from
fastapi.responses
import
FileResponse
import
os
router
=
APIRouter
()
@
router
.
get
(
"/read-file"
)
async
def
read_file
(
file_path
:
str
):
# Define the base directory for public files
base_dir
=
"/path/to/public/drive"
# Construct the full file path
full_path
=
os
.
path
.
join
(
base_dir
,
file_path
)
# Check if the file exists
if
not
os
.
path
.
isfile
(
full_path
):
raise
HTTPException
(
status_code
=
404
,
detail
=
"File not found"
)
# Return the file as a response
return
FileResponse
(
full_path
)
@
router
.
get
(
"/hello"
)
async
def
hello_world
():
return
{
"message"
:
"Hello, World!"
}
\ No newline at end of file
src/main.py
0 → 100644
View file @
4380067b
from
fastapi
import
FastAPI
from
src.api
import
router
app
=
FastAPI
()
app
.
include_router
(
router
)
if
__name__
==
"__main__"
:
import
uvicorn
uvicorn
.
run
(
app
,
host
=
"0.0.0.0"
,
port
=
8000
)
\ No newline at end of file
src/requirements.txt
View file @
4380067b
...
...
@@ -3,4 +3,5 @@ PyPDF2
scikit-learn
transformers
streamlit
fastapi
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment