# abdul-stack871/narratovission-ai architecture

> Architecture diagram of the GitHub repository abdul-stack871/narratovission-ai, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-07). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/abdul-stack871/narratovission-ai
- Repository: https://github.com/abdul-stack871/narratovission-ai

## Overview

NarratoVision is a Streamlit app that turns a user’s story into a summarized, emotion-labeled image prompt, generates an image, and offers it for display and download. The main runtime is concentrated in app.py: it handles the interface and orchestration, calls OpenRouter for story analysis, then calls Hugging Face for image generation. README documents the overall workflow and capabilities; the sampled app.py excerpts show the analysis and generation calls, but omit some interface code.

Main entry points: [`app.py`](https://github.com/abdul-stack871/narratovission-ai/blob/main/app.py) (Story analysis)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["Story interface"]
  node_streamlit_ui["Story interface<br/>[app.py]"]
  node_workflow["Workflow handler<br/>[app.py]"]
end

subgraph group_processing["Story processing"]
  node_analysis["Story analysis<br/>[app.py]"]
  node_summary["Story summary<br/>[app.py]"]
  node_emotion["Emotion result<br/>[app.py]"]
  node_prompt["Image prompt<br/>[app.py]"]
  node_openrouter{{"OpenRouter API"}}
end

subgraph group_visuals["Image output"]
  node_image_generation["Image generation<br/>[app.py]"]
  node_huggingface{{"Hugging Face API"}}
  node_generated_image["Generated image<br/>[app.py]"]
  node_image_display["Image display<br/>[app.py]"]
  node_download["Image download<br/>[app.py]"]
end

node_storyteller(("Storyteller"))

node_storyteller -->|"enters story"| node_streamlit_ui
node_streamlit_ui -->|"submits story"| node_workflow
node_workflow -->|"analyzes story"| node_analysis
node_analysis -->|"requests analysis"| node_openrouter
node_openrouter -->|"returns analysis"| node_analysis
node_analysis -->|"extracts summary"| node_summary
node_analysis -->|"detects emotion"| node_emotion
node_analysis -->|"creates prompt"| node_prompt
node_workflow -->|"requests image"| node_image_generation
node_image_generation -->|"sends prompt"| node_huggingface
node_huggingface -->|"returns image"| node_image_generation
node_image_generation -->|"produces image"| node_generated_image
node_workflow -->|"displays image"| node_image_display
node_workflow -->|"offers download"| node_download

click node_streamlit_ui "https://github.com/abdul-stack871/narratovission-ai/blob/main/app.py"
click node_workflow "https://github.com/abdul-stack871/narratovission-ai/blob/main/app.py"
click node_analysis "https://github.com/abdul-stack871/narratovission-ai/blob/main/app.py"
click node_summary "https://github.com/abdul-stack871/narratovission-ai/blob/main/app.py"
click node_emotion "https://github.com/abdul-stack871/narratovission-ai/blob/main/app.py"
click node_prompt "https://github.com/abdul-stack871/narratovission-ai/blob/main/app.py"
click node_image_generation "https://github.com/abdul-stack871/narratovission-ai/blob/main/app.py"
click node_generated_image "https://github.com/abdul-stack871/narratovission-ai/blob/main/app.py"
click node_image_display "https://github.com/abdul-stack871/narratovission-ai/blob/main/app.py"
click node_download "https://github.com/abdul-stack871/narratovission-ai/blob/main/app.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_streamlit_ui,node_workflow toneBlue
class node_analysis,node_summary,node_emotion,node_prompt,node_openrouter toneAmber
class node_image_generation,node_huggingface,node_generated_image,node_image_display,node_download toneMint
class node_storyteller toneIndigo
```

## Components

### Story interface

- [Story interface](https://github.com/abdul-stack871/narratovission-ai/blob/main/app.py): `app.py`
- [Workflow handler](https://github.com/abdul-stack871/narratovission-ai/blob/main/app.py): `app.py`

### Story processing

- [Story analysis](https://github.com/abdul-stack871/narratovission-ai/blob/main/app.py): `app.py`
- [Story summary](https://github.com/abdul-stack871/narratovission-ai/blob/main/app.py): `app.py`
- [Emotion result](https://github.com/abdul-stack871/narratovission-ai/blob/main/app.py): `app.py`
- [Image prompt](https://github.com/abdul-stack871/narratovission-ai/blob/main/app.py): `app.py`
- **OpenRouter API**

### Image output

- [Image generation](https://github.com/abdul-stack871/narratovission-ai/blob/main/app.py): `app.py`
- **Hugging Face API**
- [Generated image](https://github.com/abdul-stack871/narratovission-ai/blob/main/app.py): `app.py`
- [Image display](https://github.com/abdul-stack871/narratovission-ai/blob/main/app.py): `app.py`
- [Image download](https://github.com/abdul-stack871/narratovission-ai/blob/main/app.py): `app.py`

### Other components

- **Storyteller**

## Connections

- Storyteller → Story interface: enters story (evidence: `README.md`)
- Story interface → Workflow handler: submits story (evidence: `README.md`)
- Workflow handler → Story analysis: analyzes story (evidence: `README.md`)
- Story analysis → OpenRouter API: requests analysis (evidence: `app.py`)
- OpenRouter API → Story analysis: returns analysis (evidence: `app.py`)
- Story analysis → Story summary: extracts summary (evidence: `README.md`)
- Story analysis → Emotion result: detects emotion (evidence: `README.md`)
- Story analysis → Image prompt: creates prompt (evidence: `README.md`)
- Workflow handler → Image generation: requests image (evidence: `app.py`)
- Image generation → Hugging Face API: sends prompt (evidence: `app.py`)
- Hugging Face API → Image generation: returns image (evidence: `app.py`)
- Image generation → Generated image: produces image (evidence: `app.py`)
- Workflow handler → Image display: displays image (evidence: `app.py`)
- Workflow handler → Image download: offers download (evidence: `app.py`)
