{"id":19297366,"url":"https://github.com/midhunpaul396/visitorclassifierfullstack","last_synced_at":"2026-04-12T09:01:43.810Z","repository":{"id":260126849,"uuid":"880413568","full_name":"midhunpaul396/VisitorClassifierFullstack","owner":"midhunpaul396","description":"The app allows users to submit a URL, scrapes the content, generates questions based on the content using OpenAI's GPT API, and categorizes users based on their answers.","archived":false,"fork":false,"pushed_at":"2024-11-05T02:04:13.000Z","size":187,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-24T00:45:07.011Z","etag":null,"topics":["flask","openai","python","react"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/midhunpaul396.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-10-29T17:19:52.000Z","updated_at":"2024-11-05T02:04:17.000Z","dependencies_parsed_at":"2024-10-29T18:45:11.225Z","dependency_job_id":null,"html_url":"https://github.com/midhunpaul396/VisitorClassifierFullstack","commit_stats":null,"previous_names":["midhunpaul396/visitorclassifierfullstack"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/midhunpaul396%2FVisitorClassifierFullstack","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/midhunpaul396%2FVisitorClassifierFullstack/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/midhunpaul396%2FVisitorClassifierFullstack/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/midhunpaul396%2FVisitorClassifierFullstack/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/midhunpaul396","download_url":"https://codeload.github.com/midhunpaul396/VisitorClassifierFullstack/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240400295,"owners_count":19795331,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["flask","openai","python","react"],"created_at":"2024-11-09T23:04:16.116Z","updated_at":"2026-04-12T09:01:38.785Z","avatar_url":"https://github.com/midhunpaul396.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# React + Flask Web Scraper with OpenAI Integration\n\nThis project is a full-stack web application that uses React for the frontend and Flask for the backend. The app allows users to submit a URL, scrapes the content, generates questions based on the content using OpenAI's GPT API, and categorizes users based on their answers.\n![image](https://github.com/user-attachments/assets/108919fa-a40f-4450-8c9d-c0fd0ab26d59)\n![image](https://github.com/user-attachments/assets/ed62e099-e7f1-469a-8192-ec54ff6b043b)\n\n\n## Table of Contents\n\n- [Features](#features)\n- [Tech Stack](#tech-stack)\n- [Setup Instructions](#setup-instructions)\n- [Usage](#usage)\n- [Project Structure](#project-structure)\n- [API Documentation](#api-documentation)\n- [Testing](#testing)\n- [Troubleshooting](#troubleshooting)\n- [Contributing](#contributing)\n- [License](#license)\n\n## Features\n\n- Scrapes content from a provided URL.\n- Uses OpenAI GPT API to generate dynamic questions based on content.\n- Presents questions to the user and categorizes them based on answers.\n- Mock responses available for testing without consuming OpenAI quota.\n\n## Tech Stack\n\n- **Frontend**: React, Axios\n- **Backend**: Flask, Flask-CORS, BeautifulSoup, OpenAI API\n- **Libraries**: Python, Node.js\n- **Third-Party Services**: OpenAI GPT API\n\n## Setup Instructions\n\n### Prerequisites\n\n- Python 3.x\n- Node.js and npm\n- OpenAI API key\n\n### Backend Setup (Flask)\n\n1. Clone the repository and navigate to the `flask-backend` directory:\n   ```bash\n   git clone \u003crepo_url\u003e\n   cd react-flask-app/flask-backend\n   ```\n\n2. Create and activate a virtual environment:\n   ```bash\n   python3 -m venv venv\n   source venv/bin/activate  # On Windows use `venv\\Scripts\\activate`\n   ```\n\n3. Install dependencies:\n   ```bash\n   pip install -r requirements.txt\n   ```\n\n4. Create a `.env` file in the `flask-backend` directory and add your OpenAI API key:\n   ```plaintext\n   OPENAI_API_KEY=your_openai_api_key\n   ```\n\n5. Start the Flask server:\n   ```bash\n   python app.py\n   ```\n\n### Frontend Setup (React)\n\n1. Navigate to the `react-frontend` directory:\n   ```bash\n   cd ../react-frontend\n   ```\n\n2. Install dependencies:\n   ```bash\n   npm install\n   ```\n\n3. Start the React development server:\n   ```bash\n   npm start\n   ```\n\nThe React app should now be running at `http://localhost:3000`, and the Flask API server should be running at `http://localhost:5000`.\n\n## Usage\n\n1. Open the React app in your browser at `http://localhost:3000`.\n2. Enter a URL in the input field and submit.\n3. The backend will scrape the content, generate questions, and display them in the app.\n4. Select answers to the questions and submit to view your categorized result.\n\n### Example Screenshots\n![image](https://github.com/user-attachments/assets/3787926c-4938-41c0-81ff-706d3883a442)\n![image](https://github.com/user-attachments/assets/1049446b-fcaf-467a-9e6d-6aa3decb7c31)\n\n\n\n## Project Structure\n\n```plaintext\nreact-flask-app/\n├── flask-backend/\n│   ├── app.py              # Flask API setup and route handlers\n│   ├── requirements.txt    # Python dependencies for Flask\n│   ├── .env                # Environment variables (not in repo)\n│   └── venv/               # Virtual environment (not in repo)\n├── react-frontend/\n│   ├── src/\n│   │   ├── App.js          # Main React component\n│   │   └── index.js        # Entry point for React\n│   ├── package.json        # Node dependencies for React\n└── README.md               # Project documentation\n```\n\n## API Documentation\n\n### POST /generate-questions\n- **Description**: Accepts a URL, scrapes content, and returns generated questions.\n- **Request Body**:\n  ```json\n  {\n    \"url\": \"https://example.com\"\n  }\n  ```\n- **Response**:\n  ```json\n  {\n    \"questions\": [\n      {\n        \"question\": \"What is your primary interest?\",\n        \"options\": [\"Technology\", \"Science\", \"Literature\"]\n      }\n    ]\n  }\n  ```\n\n### POST /categorize\n- **Description**: Accepts user responses and returns a category.\n- **Request Body**:\n  ```json\n  {\n    \"user_response\": \"Science, Hands-on Practice\"\n  }\n  ```\n- **Response**:\n  ```json\n  {\n    \"category\": \"You are a hands-on science enthusiast.\"\n  }\n  ```\n\n## Testing\n\n### Mock Testing\nFor testing without consuming OpenAI API quota, mock the `analyze_with_chatgpt` function in `app.py` as follows:\n\n```python\ndef analyze_with_chatgpt(content):\n    return {\n        \"questions\": [\n            {\n                \"question\": \"Sample question?\",\n                \"options\": [\"Option A\", \"Option B\", \"Option C\"]\n            }\n        ]\n    }\n```\n\nThis setup allows testing of the frontend without relying on the OpenAI API.\n\n## Troubleshooting\n\n### CORS Issues\nIf you see a CORS error in the console, ensure `flask-cors` is installed, and `CORS(app)` is in your `app.py` file.\n\n### OpenAI Quota Errors\nIf you see \"quota exceeded\" errors, verify your OpenAI account plan and usage on the [OpenAI Usage Page](https://platform.openai.com/account/usage).\n\n## Contributing\n\n1. Fork the repository.\n2. Create a new branch (`git checkout -b feature-branch`).\n3. Make your changes and commit (`git commit -m 'Add feature'`).\n4. Push to the branch (`git push origin feature-branch`).\n5. Open a Pull Request.\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmidhunpaul396%2Fvisitorclassifierfullstack","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmidhunpaul396%2Fvisitorclassifierfullstack","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmidhunpaul396%2Fvisitorclassifierfullstack/lists"}