Skip to content

Commit 1662818

Browse files
authored
Merge pull request #2868 from oracle-devrel/ao-ref-arch-generation
New asset
2 parents 4580b15 + e17b880 commit 1662818

8 files changed

Lines changed: 783 additions & 0 deletions

File tree

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
Copyright (c) 2025 Oracle and/or its affiliates.
2+
3+
The Universal Permissive License (UPL), Version 1.0
4+
5+
Subject to the condition set forth below, permission is hereby granted to any
6+
person obtaining a copy of this software, associated documentation and/or data
7+
(collectively the "Software"), free of charge and under any and all copyright
8+
rights in the Software, and any and all patent rights owned or freely
9+
licensable by each licensor hereunder covering either (i) the unmodified
10+
Software as contributed to or provided by such licensor, or (ii) the Larger
11+
Works (as defined below), to deal in both
12+
13+
(a) the Software, and
14+
(b) any piece of software and/or hardware listed in the lrgrwrks.txt file if
15+
one is included with the Software (each a "Larger Work" to which the Software
16+
is contributed by such licensors),
17+
18+
without restriction, including without limitation the rights to copy, create
19+
derivative works of, display, perform, and distribute the Software and make,
20+
use, sell, offer for sale, import, export, have made, and have sold the
21+
Software and the Larger Work(s), and to sublicense the foregoing rights on
22+
either these or other terms.
23+
24+
This license is subject to the following condition:
25+
The above copyright notice and either this complete permission notice or at
26+
a minimum a reference to the UPL must be included in all copies or
27+
substantial portions of the Software.
28+
29+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
30+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
31+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
32+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
33+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
34+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
35+
SOFTWARE.
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
# OCI Architecture Diagram Generator
2+
3+
A Streamlit demo that turns a natural-language description of an Oracle Cloud Infrastructure workload into a production-quality reference architecture diagram. The user describes the components, zones, and numbered data-flow steps; the app prepends a strict OCI visual style guide and sends the combined prompt to one of three image models on OCI Generative AI: Qwen-Image-Edit on a Dedicated AI Cluster, Grok Imagine. An iterative refinement loop lets the user nudge successive regenerations without losing history, and Qwen runs in style-transfer mode against an uploaded reference architecture image.
4+
5+
## When to Use This Asset?
6+
7+
Use this asset to show enterprise and government clients how OCI Generative AI accelerates solution-architecture work, converting an analyst's written description of a system into a visual reference diagram in seconds with a refinement loop that mirrors the back-and-forth of real architecture-review sessions. It is particularly relevant for:
8+
9+
- Pre-sales and solution-engineering teams producing first-draft reference architectures during workshops
10+
- Internal sales-enablement sessions where reps need to communicate the shape of an OCI solution to a non-technical audience
11+
- Side-by-side comparison of three image model families (Qwen on DAC, Grok Imagine) on the same enterprise prompt
12+
- Demonstrating how a detailed style guide constrains image output to a specific corporate visual language — OCI icon set, compartment, VCN, and subnet conventions, numbered flow steps, monochrome icons with burnt-orange dashed boundaries
13+
- Showing how Qwen-Image-Edit on a Dedicated AI Cluster can act as a style-transfer engine, inheriting the visual language of an existing reference diagram and rendering new ones in the same house style
14+
15+
## How to Use This Asset?
16+
17+
1. Launch the app with `streamlit run app.py`.
18+
2. In the sidebar, choose the image model (Qwen DAC, or Grok Imagine) and the output aspect (landscape recommended for OCI diagrams).
19+
3. On first load, click one of the sample chips (RAG Chatbot, Document Pipeline, Multi-Region HA) to pre-fill the description, or write your own. Name every component, the zones they sit in (On Premises, OCI Region, Availability Domain, LZ Compartment, VCN, Subnet, Oracle Services Network), and number each step of the data flow.
20+
4. If using Qwen, upload a reference architecture image in the sidebar — Qwen runs in image-edit mode and inherits its visual style from the reference.
21+
5. Click **Generate**. The app prepends the OCI style guide to the description and calls the selected model.
22+
6. Once an image is rendered, a second text area appears for **refinement** instructions. Enter a tweak (move a component, add a step, fix labelling) and click **Regenerate** — the prompt is rebuilt with style guide, description, and refinement.
23+
7. Every iteration is kept in session history with its model, timestamp, and refinement note. Download any generation as PNG.
24+
8. Click **Reset session** in the sidebar to clear history and start over.
25+
26+
## File Structure
27+
28+
```
29+
oci-architecture-generator/
30+
├── app.py # Streamlit UI, session state, generation dispatch
31+
├── clients.py # OCI Generative AI clients (openai SDK)
32+
├── prompts.py # OCI visual style guide prepended to every prompt
33+
├── requirements.txt
34+
├── .env.example
35+
├── .streamlit/
36+
│ └── config.toml # Light theme — Anthropic-inspired warm palette
37+
├── LICENSE
38+
└── README.md
39+
```
40+
41+
## Setup
42+
43+
Prerequisites: Python 3.11 or later, an OCI tenancy with Generative AI access in the Chicago region, an OCI Generative AI API key and project OCID, and a Qwen-Image-Edit model deployed on a Dedicated AI Cluster if Qwen is needed.
44+
45+
```bash
46+
python -m venv .venv
47+
source .venv/bin/activate
48+
pip install -r requirements.txt
49+
cp .env.example .env
50+
```
51+
52+
Edit `.env` with your tenancy values:
53+
54+
- `OPENAI_API_KEY_CHICAGO` — OCI Generative AI API key (begins with `sk-…`)
55+
- `CHICAGO_PROJECT_OCID` — OCI Generative AI project OCID
56+
- `OCI_COMPARTMENT_ID` — compartment OCID with Generative AI access
57+
- `OCI_GENAI_BASE` — OCI Generative AI host (e.g. `https://inference.generativeai.us-chicago-1.oci.oraclecloud.com`)
58+
- `OCI_QWEN_DAC_ENDPOINT_OCID` — OCID of the Qwen-Image-Edit Dedicated AI Cluster endpoint, used as the model identifier
59+
- `OCI_CONFIG_PROFILE` — display label for the sidebar status panel
60+
61+
Run:
62+
63+
```bash
64+
streamlit run app.py
65+
```
66+
67+
## Useful Links / License
68+
69+
- OCI Generative AI documentation: https://docs.oracle.com/en-us/iaas/Content/generative-ai/home.htm
70+
- OCI Generative AI OpenAI-compatible API: https://docs.oracle.com/en-us/iaas/Content/generative-ai/openai-api.htm
71+
- OCI architecture and icon reference: https://docs.oracle.com/en/solutions/
72+
73+
Licensed under the Universal Permissive License v 1.0 — see `LICENSE`.
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
OPENAI_API_KEY_CHICAGO=<Add OCI API key here>
2+
CHICAGO_PROJECT_OCID=<Add project OCID here>
3+
OCI_COMPARTMENT_ID=<Add compartment OCID here>
4+
OCI_CONFIG_PROFILE=CHICAGO
5+
OCI_QWEN_DAC_ENDPOINT_OCID=<Add DAC endpoint here>
6+
OCI_REGION=us-chicago-1
7+
OCI_GENAI_BASE=https://inference.generativeai.us-chicago-1.oci.oraclecloud.com
8+
OCI_QWEN_DAC_ENDPOINT=https://inference.generativeai.us-chicago-1.oci.oraclecloud.com

0 commit comments

Comments
 (0)