This project is a FastAPI backend that uses a fine-tuned Hugging Face transformer model to generate interview-style questions and answers from user input.
It applies text preprocessing (stopword removal, keyword extraction) before sending the input to the model to improve generation quality.
- REST API built with FastAPI
- Text preprocessing (stopword removal, keyword filtering)
- Integration with a Hugging Face text-generation model
- Extracts structured JSON (question & answer) from model output
project-backend/
├── src/
│ └── main.py # FastAPI application
├── .venv/ # Virtual environment
├── requirements.txt # Python dependencies
└── README.md # Documentation
-
Clone the repository:
git clone https://github.com/your-username/interview-assistant-backend.git cd interview-assistant-backend -
Create and activate a virtual environment:
python -m venv .venv .venv\Scripts\activate # On Windows source .venv/bin/activate # On Linux/Mac
-
Install dependencies:
pip install -e .
Start the FastAPI app with Uvicorn:
cd src
uvicorn main:appThe server will start at: http://127.0.0.1:8000
- Endpoint:
/generate(POST)
Request Body:
{
"text": "Can you tell me about React static decorators?"
}Preprocessing applied:
react static decorators
Example Response:
{
"question": "What is React Static Decorators?",
"answer": "Decorators that change the behavior of React components but render the same after the render() call, ensuring React interoperability."
}If parsing fails:
{
"error": "Could not parse the generated text."
}- Python 3.9+
- FastAPI
- Uvicorn
- Transformers (Hugging Face)
- NLTK (for preprocessing)
Install everything with:
pip install -e .