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
79fb0e78
Commit
79fb0e78
authored
Jan 18, 2025
by
Prayas Jain
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Intgegrate api with submit button
parent
4380067b
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
34 additions
and
6 deletions
+34
-6
api.py
src/api.py
+13
-0
dashboard.py
src/dashboard.py
+18
-5
requirements.txt
src/requirements.txt
+3
-1
No files found.
src/api.py
View file @
79fb0e78
from
fastapi
import
APIRouter
,
HTTPException
from
fastapi.responses
import
FileResponse
from
pydantic
import
BaseModel
import
os
router
=
APIRouter
()
# Define a Pydantic model for the data we expect in the POST request
class
InputData
(
BaseModel
):
jobTitle
:
str
department
:
str
jobDescription
:
str
# POST endpoint
@
router
.
post
(
"/submit/"
)
async
def
submit_data
(
data
:
InputData
):
# Here, you can process the data (e.g., save it to a database)
return
{
"message"
:
"Data received successfully!"
,
"data"
:
data
.
dict
()}
@
router
.
get
(
"/read-file"
)
async
def
read_file
(
file_path
:
str
):
# Define the base directory for public files
...
...
src/dashboard.py
View file @
79fb0e78
import
streamlit
as
st
import
requests
# FastAPI URL (assuming it is running locally on port 8000)
API_URL
=
"http://127.0.0.1:8000/submit/"
# Title of the app
st
.
title
(
"Enter JD to fetch resumes!"
)
...
...
@@ -11,9 +15,18 @@ job_description = st.text_area("Job Description", height=200)
# Add a submit button
if
st
.
button
(
"Submit"
):
if
job_title
and
department
and
job_description
:
st
.
success
(
"Job Description Submitted Successfully!"
)
st
.
write
(
f
"**Job Title:** {job_title}"
)
st
.
write
(
f
"**Department:** {department}"
)
st
.
write
(
f
"**Job Description:** {job_description}"
)
data
=
{
"jobTitle"
:
job_title
,
"department"
:
department
,
"jobDescription"
:
job_description
}
response
=
requests
.
post
(
API_URL
,
json
=
data
)
# If the request is successful, display the response
if
response
.
status_code
==
200
:
result
=
response
.
json
()
st
.
success
(
result
[
'message'
])
st
.
write
(
"Received Data:"
,
result
[
'data'
])
else
:
st
.
error
(
f
"Error: {response.status_code}"
)
else
:
st
.
error
(
"Please fill in all the fields."
)
\ No newline at end of file
st
.
warning
(
"Please fill in all the fields!"
)
\ No newline at end of file
src/requirements.txt
View file @
79fb0e78
...
...
@@ -4,4 +4,6 @@ scikit-learn
transformers
streamlit
fastapi
uvicorn
requests
router
\ No newline at end of file
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