{"id":25314972,"url":"https://github.com/jasdvl/demo-aspnetcore-fastapi-ai","last_synced_at":"2026-04-30T22:36:16.872Z","repository":{"id":276398489,"uuid":"900953366","full_name":"jasdvl/demo-aspnetcore-fastapi-ai","owner":"jasdvl","description":"A web application showcasing AI techniques.","archived":false,"fork":false,"pushed_at":"2025-04-27T18:56:07.000Z","size":2748,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-23T17:49:46.894Z","etag":null,"topics":["ai","angular","aspnetcore","chatbot","envoy","envoy-proxy","fastapi","gen-ai","image-analysis","llm","nlp","python"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jasdvl.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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,"zenodo":null}},"created_at":"2024-12-09T19:17:21.000Z","updated_at":"2025-04-27T18:56:10.000Z","dependencies_parsed_at":"2025-02-08T01:23:31.697Z","dependency_job_id":"4d16c291-8c74-4be5-a20a-2d44d7c92dfa","html_url":"https://github.com/jasdvl/demo-aspnetcore-fastapi-ai","commit_stats":null,"previous_names":["jasdvl/demo-aspnetcore-fastapi-ai"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/jasdvl/demo-aspnetcore-fastapi-ai","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jasdvl%2Fdemo-aspnetcore-fastapi-ai","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jasdvl%2Fdemo-aspnetcore-fastapi-ai/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jasdvl%2Fdemo-aspnetcore-fastapi-ai/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jasdvl%2Fdemo-aspnetcore-fastapi-ai/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jasdvl","download_url":"https://codeload.github.com/jasdvl/demo-aspnetcore-fastapi-ai/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jasdvl%2Fdemo-aspnetcore-fastapi-ai/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32479448,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-30T13:12:12.517Z","status":"ssl_error","status_checked_at":"2026-04-30T13:12:06.837Z","response_time":57,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["ai","angular","aspnetcore","chatbot","envoy","envoy-proxy","fastapi","gen-ai","image-analysis","llm","nlp","python"],"created_at":"2025-02-13T17:39:21.520Z","updated_at":"2026-04-30T22:36:11.865Z","avatar_url":"https://github.com/jasdvl.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# AIxplorer\n\n![AIxplorer](./assets/architecture-overview.png)\n\n## Screenshots\n\nCheck out the [screenshots](./screenshots.md) for a visual overview.\n\n## Project Overview\n\n**AIxplorer** is a demo application showcasing the integration of artificial intelligence (AI) in a modern web environment.  \nThe project consists of an Angular-based frontend (aixplorer.client) and multiple microservices (ASP.NET Core, FastAPI) that interact with AI models such as Phi-3.5 and Stable Diffusion.  \n\nThe application supports:  \n- **Image analysis, interpretation, and recognition**  \n- **Natural language processing (NLP) chat**  \n- **Text-to-image generation**  \n\n\u003e **Note:**  \n\u003e \n\u003e This project is for demonstration purposes only and is not intended for production use.  \n\u003e HTTP (not HTTPS) is used for communication between components within a trusted network, such as the Envoy proxy and microservices, where TLS encryption is not necessary.  \n\u003e However, for production use, it's crucial to secure the connection between the user and the Angular app, as well as potentially between Angular and the Envoy proxy, using HTTPS \n\u003e and proper encryption.  \n\u003e Furthermore, for a production-grade application, additional improvements are necessary, such as secure authentication, centralized logging, and robust error handling.  \n\u003e \n\u003e The AI models are not included in this repository. They can be downloaded from Hugging Face. For details, see [Download AI Models](#download-ai-models).  \n\u003e Additionally, while this project currently integrates Phi-3.5 and Stable Diffusion models, other AI models can also be integrated as long as the existing interfaces \n\u003e are compatible with the new models or can be adapted. The integration process has been tested with the mentioned models but can be extended to include other models based \n\u003e on the requirements of your application.\n\u003e\n\u003e Future updates will primarily focus on refactoring efforts, such as addressing compiler warnings and improving code comments. See the [TODO List](#todo-list) for planned \n\u003e improvements.\n\n### Key Components\n\n1. **`aixplorer.client` (Angular)**  \n   The **frontend** of the application, built with Angular, providing a simple and intuitive UI for interacting with AI-driven services.  \n\n2. **`AIxplorer.Proxy` (Envoy Proxy)**  \n   [Envoy Proxy](https://www.envoyproxy.io/) is used as a gateway to route requests between services efficiently.  \n\n3. **`AIxplorer.Vision.Interpretation` (ASP.NET Core)**  \n   A **computer vision service** that handles **image analysis and interpretation**.  \n   - **Developed and tested using Phi-3.5 Vision**.  \n\n4. **`AIxplorer.Nlp.QnA` (ASP.NET Core)**  \n   An **NLP chatbot** capable of answering questions and engaging in contextual conversations.  \n   - **Developed and tested using Phi-3.5 Mini**.  \n\n5. **`AIxplorer.GenAI.ImageGen` (FastAPI, Python)**  \n   An **AI-based image generation service** using the **Stable Diffusion** model to create images from text prompts.  \n   - **Developed and tested using Stable Diffusion 3.5 Medium**.  \n\n## Prerequisites\n\n- [.NET 9 SDK](https://dotnet.microsoft.com/download/dotnet/9.0)\n- [Visual Studio 2022](https://visualstudio.microsoft.com/vs/) or [Visual Studio Code](https://code.visualstudio.com/)\n- [Docker](https://www.docker.com/)\n- [Python](#python-setup-instructions-windows)\n- [Protocol Buffer Compiler](https://grpc.io/docs/protoc-installation/) (optional, for generation of new descriptor sets for Envoy)\n\n### Python Setup Instructions (Windows)\n\n1. Install Python  \n   Make sure you have Python 3.9 or later installed. You can download it from [python.org](https://www.python.org/downloads/windows/).\n\n2. Navigate to the Project Folder\n   \n    ```\n    cd src\\AIxplorer.GenAI.ImageGen\n    ```\n\n3. Create a Virtual Environment  \n   It is recommended to use a virtual environment to manage dependencies. Run the following commands:\n   ```\n   python -m venv imagegen_env\n   ```\n\n4. Activate the Virtual Environment\n   \n     ```\n     .\\imagegen_env\\Scripts\\activate\n     ```\n\n5. Install Dependencies\n   Install the required Python libraries from the `requirements.txt` file:\n   ```\n   pip install -r requirements.txt\n   ```\n\n## Getting Started\n\n### Clone the repository:\n\n```\ngit clone https://github.com/jasdvl/demo-aspnetcore-fastapi-ai.git\n```\n\n### Download AI models\n\nStable Diffusion 3.5 Medium (~ 80 GB)\n\n```git clone https://huggingface.co/stabilityai/stable-diffusion-3.5-medium```\n\nPhi 3.5 Vision (~ 10 GB)\n\n```git clone https://huggingface.co/microsoft/Phi-3.5-vision-instruct```\n\nPhi 3.5 Mini (~ 10 GB)\n\n```git clone https://huggingface.co/microsoft/Phi-3.5-mini-instruct```\n\n### Configure model paths\n\n1. **AIxplorer.GenAI.ImageGen**\n   \n   Rename ```.env.example``` to ```.env```. Set the Stable Diffusion model path and adjust the server host and port to suit your needs.  \n   \n2. **AIxplorer.Vision.Interpretation (ASP.NET Core)**\n   \n   Adjust the ```ModelPath``` setting in ```appsettings.Development.json```.\n\n3. **AIxplorer.Nlp.QnA (ASP.NET Core)**\n   \n   Adjust the ```ModelPath``` setting in ```appsettings.Development.json```.\n\n### Start the Application\n\nFirst start the Envoy Proxy:\n   \nOpen a new terminal window and navigate to the Envoy project directory:\n\n```bash\ncd demo-aspnetcore-fastapi-ai/src/AIxplorer.Proxy\n```\n\nPull the Envoy Docker image and start the Envoy proxy with the custom configuration file. In a new terminal window, run the following commands:  \n\n```\ndocker pull envoyproxy/envoy:v1.33-latest\n```\n\nStart the Envoy proxy:\n\n```\ndocker run --rm -it ^\n-v %cd%\\envoy-custom.yaml:/etc/envoy/envoy.yaml ^\n-v %cd%\\grpc_service_descriptors.pb:/etc/envoy/grpc_service_descriptors.pb ^\n-p 9901:9901 -p 10000:10000 ^\n--name envoy-v1.33 envoyproxy/envoy:v1.33-latest ^\n-c /etc/envoy/envoy.yaml --log-level debug\n```\n\nThis starts the Envoy proxy, binding it to ports 9901 and 10000, using the configuration specified in envoy-custom.yaml.\n\n#### Option 1: Start the Application from the Command Line\n\n1. Navigate to the Angular frontend directory, install dependencies, and start the Angular application:\n\n    ```bash\n    cd ../aixplorer.client\n    npm install\n    ng serve\n    ```\n\n   This starts the Angular development server on port 6700.\n\n2. Navigate to the **AIxplorer.Vision.Interpretation** and **AIxplorer.Nlp.QnA** directories and restore the project dependencies:\n\n    ```bash\n    cd ../AIxplorer.Vision.Interpretation\n    dotnet restore\n    dotnet run  \n    ```\n\n    ```bash\n    cd ../AIxplorer.Nlp.QnA\n    dotnet restore\n    dotnet run  \n    ```\n\n    This will start the ASP.NET Core microservices, accessible at `http://localhost:5220` and `http://localhost:5230`.\n\n3. Navigate to the **AIxplorer.GenAI.ImageGen** directory and start the FastAPI application using Uvicorn:\n   \n    ```\n    cd ..\\AIxplorer.GenAI.ImageGen\n    ```\n\n    ```\n    uvicorn app.main:app --host 0.0.0.0 --port 7600 --reload --log-level debug\n    ```\n\n    This will start the FastAPI service on `http://localhost:7600`.\n\n5. Start the application on `http://localhost:10000`\n\n#### Option 2: Start the Application in Visual Studio\n\nConfigure multiple startup projects and select `AIxplorer.Vision.Interpretation`, `AIxplorer.Nlp.QnA`, `AIxplorer.GenAI.ImageGen`, and `aixplorer.client`.\n\n**Note:**  \n\u003e If you're unfamiliar with how to set multiple startup projects in Visual Studio, \n\u003e you can check the official [Visual Studio documentation](https://learn.microsoft.com/en-us/visualstudio/ide/how-to-set-multiple-startup-projects?view=vs-2022).\n\n## Creating a proto descriptor set\n\nWhen modifying or adding `.proto` files, it's important to update the protobuf descriptor set for Envoy to ensure proper routing and processing of gRPC requests.  \nFollow these steps to do so:\n\n1. Navigate to the `src` directory:\n\n    ```bash\n    cd demo-aspnetcore-fastapi-ai/src\n    ```\n\n2. Generate the updated `.proto` descriptor set by running the following `protoc` command:\n   \n    ```\n    protoc -I.\\AIxplorer.Grpc.Contracts --include_imports --include_source_info ^\n    --descriptor_set_out=.\\AIxplorer.Proxy\\grpc_service_descriptors.pb ^\n    .\\AIxplorer.Grpc.Contracts\\computer_vision\\image_interpretation_service.proto ^\n    .\\AIxplorer.Grpc.Contracts\\nlp\\question_answering_service.proto\n    ```\n\n\u003e **Note:** For further information, refer to the Envoy documentation on the [gRPC-JSON Transcoder Filter](https://www.envoyproxy.io/docs/envoy/latest/configuration/http/http_filters/grpc_json_transcoder_filter).\n\n### Note on Google Protobuf Files\n\nTo simplify handling, the Google Protobuf files (`annotations.proto` and `http.proto`) have been copied directly into the `AIxplorer.Grpc.Contracts` C# library. While this approach makes the integration straightforward, it is not considered clean or maintainable for larger projects.\nA better alternative would be to reference these files from a centralized location, such as a local clone of the official Google APIs repository.\nThis would provide better maintainability and alignment with best practices.\n\n\n## TODO List\n\n- Fix compiler warnings\n- Add comments where they are still missing\n\n## Branching Strategy\n\nSince I am the sole developer on this project, I primarily work on the `main` branch. I prefer to keep things simple by committing directly to `main` for most tasks. However, if a new feature requires multiple related commits or substantial changes, I will create feature branches to manage those updates. Once the feature is complete, the branch will be merged back into `main`. My goal is to keep the main branch stable and up to date.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjasdvl%2Fdemo-aspnetcore-fastapi-ai","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjasdvl%2Fdemo-aspnetcore-fastapi-ai","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjasdvl%2Fdemo-aspnetcore-fastapi-ai/lists"}