{"id":15129796,"url":"https://github.com/ansh420/fastapi","last_synced_at":"2026-01-18T20:32:56.177Z","repository":{"id":255606735,"uuid":"851563335","full_name":"Ansh420/FastAPI","owner":"Ansh420","description":"API links for the text Extract from Url's and pdf's and finding similar words using cosine.","archived":false,"fork":false,"pushed_at":"2024-10-15T05:16:52.000Z","size":399,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-05T19:19:02.660Z","etag":null,"topics":["docker-container","fastapi","ma","pdfs","python3","urls"],"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/Ansh420.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-09-03T10:22:05.000Z","updated_at":"2024-10-15T05:16:55.000Z","dependencies_parsed_at":"2024-09-14T14:54:42.531Z","dependency_job_id":"2c9d2868-50e6-40cb-a986-fdec4d2bca44","html_url":"https://github.com/Ansh420/FastAPI","commit_stats":null,"previous_names":["ansh420/fastapi"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ansh420%2FFastAPI","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ansh420%2FFastAPI/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ansh420%2FFastAPI/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ansh420%2FFastAPI/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Ansh420","download_url":"https://codeload.github.com/Ansh420/FastAPI/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247386403,"owners_count":20930634,"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":["docker-container","fastapi","ma","pdfs","python3","urls"],"created_at":"2024-09-26T02:20:31.881Z","updated_at":"2026-01-18T20:32:56.170Z","avatar_url":"https://github.com/Ansh420.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n![Screenshot 2024-09-07 064118](https://github.com/user-attachments/assets/c911dee9-7f8a-4698-8d2d-6abc10f5d07b)\n# FastAPI\n# **Demonstration** \nhttps://www.loom.com/share/cd1b617cc86b46838e469e908a075ae3?sid=9c269a9a-f0d2-423e-b87f-61682c9553b1\n# **scraping content from a given URL** \nstoring it in a database using SQLAlchemy, within the context of a FastAPI application. It incorporates the following key functionalities:\n\n## URL Scraping: \n\n- Extracts content from a specified URL using the requests library.\n- Cleans the extracted content by removing scripts and styles (if desired).\n- ![Screenshot 2024-09-08 124743](https://github.com/user-attachments/assets/a8e6340c-12a9-4518-b8fd-6af2d6b5993a)\n## SQLAlchemy Integration:\n\n- Creates a database engine and defines a SQLAlchemy model to represent the scraped data.\n- Creates a database table based on the model.\n- Uses a database session to add and commit scraped content to the database.\n## FastAPI Endpoint:\n\n- Exposes a POST endpoint (/process_url) that accepts a URL as input.\n- Processes the URL, scrapes the content, and stores it in the database.\n\n- Returns a response with a unique chat ID and a success message.\n## Error Handling:\n\n- Implements basic error handling for HTTP requests and database operations.\n\n # **Extract text from uploaded pdf**\n ![Screenshot 2024-09-07 064159](https://github.com/user-attachments/assets/210f5314-6620-420f-9800-d5304ba901a4)\n ## Q\u0026A Chatbot with Document Upload\n- This is a FastAPI application for a simple Q\u0026A chatbot that leverages uploaded documents.\n![Screenshot 2024-09-07 064248](https://github.com/user-attachments/assets/cb6df137-da7e-445c-86a4-9324d75e514f)\n## Features:\n\n- Supports uploading documents through URLs or PDFs.\n- Extracts text content from uploaded documents.\n- Processes user chat requests with a specific chat ID.\n- Finds the most relevant section within the uploaded document based on the user's question using cosine similarity (Note: currently uses a dummy embedding function, needs replacement).\n![Screenshot 2024-09-07 064344](https://github.com/user-attachments/assets/7b95402f-b82d-4899-8a53-7649e61b8df9)\n# **FastAPI Chatbot with Document Upload**\nThis project implements a simple chatbot that retrieves relevant information from uploaded documents.\n![Screenshot 2024-09-09 065911](https://github.com/user-attachments/assets/471e0d5e-cbbe-47ce-821d-187862b41d90)\n## Features:\n\n- Supports uploading documents through URLs or PDFs.\n- Extracts text content from uploaded documents.\n- Processes user questions and identifies the most relevant section based on cosine similarity.\n\n## Technologies:\n\n- FastAPI: Web framework for building APIs\n- Pydantic: Data validation and serialization\n- requests: Making HTTP requests\n- BeautifulSoup: Parsing HTML documents\n- pdfminer: Extracting text from PDFs\n\n## Usage:\n\n### Run the application:\n$Bash\n\n$ uvicorn main:**app --host 127.0.0.1 --port 8000**\n\n\n### Upload documents:\n### Upload URL:\n$ Bash\n$ curl -X POST http://localhost:8000/upload_url/ -F chat_id=user1 -F url=https://www.example.com/article.html\n![Screenshot 2024-09-09 070158](https://github.com/user-attachments/assets/df41bf19-352b-4a14-be97-d5ce0b3bdca0)\n## Upload PDF: (using tools like curl or Postman)\nSet chat_id in the form data.\nSend a multipart request with the PDF file as file.\n## Chat interaction:\n$ Bash\n$ curl -X POST http://localhost:8000/chat/ -H 'Content-Type: application/json' -d '{\"chat_id\": \"user1\", \"question\": \"What is the capital of France?\"}'\n![Screenshot 2024-09-09 070220](https://github.com/user-attachments/assets/1d5ea7a9-f1f0-45a2-a1bc-71ab86e8cc3c)\n\n## Return\nThis will return a JSON response containing the most relevant section from the uploaded document for user1 based on the question. \n\n![Screenshot 2024-09-09 070252](https://github.com/user-attachments/assets/cbe6712a-e3df-49ca-8f71-e2646f9ed3a2)\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fansh420%2Ffastapi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fansh420%2Ffastapi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fansh420%2Ffastapi/lists"}