Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions ai/generative-ai-service/card-recognition-generator/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
Copyright (c) 2026 Oracle and/or its affiliates.

The Universal Permissive License (UPL), Version 1.0

Subject to the condition set forth below, permission is hereby granted to any
person obtaining a copy of this software, associated documentation and/or data
(collectively the "Software"), free of charge and under any and all copyright
rights in the Software, and any and all patent rights owned or freely
licensable by each licensor hereunder covering either (i) the unmodified
Software as contributed to or provided by such licensor, or (ii) the Larger
Works (as defined below), to deal in both

(a) the Software, and
(b) any piece of software and/or hardware listed in the lrgrwrks.txt file if
one is included with the Software (each a "Larger Work" to which the Software
is contributed by such licensors),

without restriction, including without limitation the rights to copy, create
derivative works of, display, perform, and distribute the Software and make,
use, sell, offer for sale, import, export, have made, and have sold the
Software and the Larger Work(s), and to sublicense the foregoing rights on
either these or other terms.

This license is subject to the following condition:
The above copyright notice and either this complete permission notice or at
a minimum a reference to the UPL must be included in all copies or
substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
86 changes: 86 additions & 0 deletions ai/generative-ai-service/card-recognition-generator/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
# Recognition Card Generator

Internal demo application: generates branded employee recognition cards (background via image API, typography and layout composed in software), plus a web UI to upload employee CSV data, generate previews, download PNGs, and compose email drafts.

All application source and assets live in **`files/`**. This README stays at the repository root so the repo is easy to browse on GitHub.

---

## Repository layout

| Path | Purpose |
|------|--------|
| `files/src/` | FastAPI backend (`react_api.py`, image client) |
| `files/frontend/` | React (Vite + TypeScript) web UI |
| `files/data/` | Sample CSV files for testing |
| `files/requirements.txt` | Python dependencies |
| `files/output/` | Generated PNGs (created at runtime, **not** committed) |

---

## Prerequisites

- **Python 3.10+** (3.11+ recommended)
- **Node.js 20+** and npm
- API credentials for your image provider (set via environment variables; see `files/src/grok_openai_image.py` and `files/src/react_api.py`)

---

## Quick start (local)

### 1. Backend

```bash
cd files
python -m venv .venv
.venv\Scripts\activate
pip install -r requirements.txt
```

Configure environment (at minimum, the variables your `ENDPOINT` / OpenAI-compatible image API expects), then:

```bash
python -m uvicorn src.react_api:app --host 127.0.0.1 --port 8055 --reload
```

### 2. Frontend

In a second terminal:

```bash
cd files/frontend
npm install
npm run dev
```

Open the URL Vite prints (usually `http://localhost:5173/`). The dev server proxies `/api/*` to `http://127.0.0.1:8055`.

### 3. Optional: company logo assets

Place official wordmarks in `files/frontend/public/` as `oracle-logo-red.png` and `oracle-logo-white.png` for exact on-card branding. Employee photos go under `files/frontend/public/employee-photos/`.

---

## CSV format

Use a header row. Important columns include `full_name`, `manager_name`, `manager_position`, `photo_asset_id` (path under `employee-photos/`), and **`employee_email`** (or `email` / `work_email`) for the email button. See `files/data/sample_employees_hr_use_cases.csv`.

---

## If you see a stray `frontend` folder at the repository root

The real app is under `files/frontend/`. A near-empty `frontend` at the top level can appear if a dev server held files open during a move. **Stop** any running `npm run dev` / Vite process, then delete the root `frontend` folder. Use only `files/frontend/` for the UI.

---

## Production notes

- Do **not** commit `files/output/`, `.env`, or `node_modules/`.
- Tune API keys and base URLs via environment variables appropriate for your company’s deployment.
- For enterprise email delivery with attachments, consider a server-side mail integration instead of relying on `mailto:` alone.

---

## License / confidentiality

Use and distribution are subject to your employer’s policies. Do not commit secrets or production credentials.
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Copy to `files/.env` and fill in. Never commit real secrets.
# Image API (see files/src/grok_openai_image.py)

ENDPOINT=
OPENAI_API_KEY=
# Optional depending on provider:
# OCI_PROJECT_ID=
# COMPARTMENT_ID=
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
employee_id,first_name,full_name,employee_email,role,department,region,latest_win,recognition_category,manager_name,tone,language,photo_asset_id,output_channel
E12345,Sara,Sara Al-Farsi,sara.alfarsi@example.com,Senior HR Analyst,HR,Middle East,Led onboarding improvements for 500 new hires,Operational Excellence,Omar Hassan,"warm, professional, celebratory",English,/employee-photos/sara-alfarsi.png,email
E12346,David,David Clarke,david.clarke@example.com,Engineering Manager,Engineering,EMEA,Completed first 90 days with strong team impact,Team Integration,Emma Wright,"warm, professional, celebratory",English,/employee-photos/david-clarke.png,intranet
E12347,Ana,Ana Rodrigues,ana.rodrigues@example.com,People Partner,HR,Americas,Launched mentorship circles across 4 offices,Employee Experience,Maria Torres,"warm, professional, celebratory",English,/employee-photos/ana-rodrigues.png,email
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import js from '@eslint/js'
import globals from 'globals'
import reactHooks from 'eslint-plugin-react-hooks'
import reactRefresh from 'eslint-plugin-react-refresh'
import tseslint from 'typescript-eslint'
import { defineConfig, globalIgnores } from 'eslint/config'

export default defineConfig([
globalIgnores(['dist']),
{
files: ['**/*.{ts,tsx}'],
extends: [
js.configs.recommended,
tseslint.configs.recommended,
reactHooks.configs.flat.recommended,
reactRefresh.configs.vite,
],
languageOptions: {
globals: globals.browser,
},
},
])
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="theme-color" content="#f5f0e5" />
<meta
name="description"
content="Generate employee recognition cards from CSV data in one click."
/>
<title>Recognition Card Studio</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
</body>
</html>
Loading