Skip to content

Commit

Permalink
Merge branch 'streamsync-cloud:dev' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
anant-writer authored May 27, 2024
2 parents 1209389 + 96fb5cc commit 5751030
Show file tree
Hide file tree
Showing 36 changed files with 661 additions and 109 deletions.
3 changes: 3 additions & 0 deletions apps/ai-starter/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
This app was created using Writer Framework.

To learn more about it, visit https://developer.writer.com/framework
14 changes: 14 additions & 0 deletions apps/ai-starter/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import writer as wf
import writer.ai

# Welcome to Writer Framework!
# This template is a starting point for your AI apps.
# More documentation is available at https://developer.writer.com/framework


# Initialise the state
wf.init_state({
"my_app": {
"title": "AI STARTER"
},
})
15 changes: 15 additions & 0 deletions apps/ai-starter/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
[tool.poetry]
name = "writer-framework-default"
version = "0.1.0"
description = ""
authors = ["Your Name <[email protected]>"]
readme = "README.md"

[tool.poetry.dependencies]
python = "^3.10.0"
writer = {version = "^0.6.0"}


[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"
8 changes: 8 additions & 0 deletions apps/ai-starter/static/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Serving static files

You can use this folder to store files which will be served statically in the "/static" route.

This is useful to store images and other files which will be served directly to the user of your application.

For example, if you store an image named "myimage.jpg" in this folder, it'll be accessible as "static/myimage.jpg".
You can use this relative route as the source in an Image component.
Binary file added apps/ai-starter/static/favicon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
54 changes: 54 additions & 0 deletions apps/ai-starter/ui.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
{
"metadata": {
"writer_version": "0.6.0rc3"
},
"components": {
"root": {
"id": "root",
"type": "root",
"content": {
"appName": "AI Starter"
},
"isCodeManaged": false,
"position": 0,
"handlers": {},
"visible": true
},
"c0f99a9e-5004-4e75-a6c6-36f17490b134": {
"id": "c0f99a9e-5004-4e75-a6c6-36f17490b134",
"type": "page",
"content": {
"pageMode": "compact"
},
"isCodeManaged": false,
"position": 0,
"parentId": "root",
"handlers": {},
"visible": true
},
"bebc5fe9-63a7-46a7-b0fa-62303555cfaf": {
"id": "bebc5fe9-63a7-46a7-b0fa-62303555cfaf",
"type": "header",
"content": {
"text": "@{my_app.title}"
},
"isCodeManaged": false,
"position": 0,
"parentId": "c0f99a9e-5004-4e75-a6c6-36f17490b134",
"handlers": {},
"visible": true
},
"ejpasds0o8qyjs1n": {
"id": "ejpasds0o8qyjs1n",
"type": "section",
"content": {
"title": "Section Title"
},
"isCodeManaged": false,
"position": 1,
"parentId": "c0f99a9e-5004-4e75-a6c6-36f17490b134",
"handlers": {},
"visible": true
}
}
}
22 changes: 2 additions & 20 deletions apps/default/README.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,3 @@
# Writer Framework app

## Editing the project

```bash
poetry install
poetry run writer edit .
```

## Running the project

```bash
poetry run writer run .
```

## Deploying the project

```bash
poetry run writer deploy .
```
This app was created using Writer Framework.

To learn more about it, visit https://developer.writer.com/framework
2 changes: 1 addition & 1 deletion apps/default/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# This is a placeholder to get you started or refresh your memory.
# Delete it or adapt it as necessary.
# Documentation is available at https://streamsync.cloud
# Documentation is available at https://developer.writer.com/framework

# Shows in the log when the app starts
print("Hello world!")
Expand Down
Binary file modified apps/default/static/favicon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
22 changes: 2 additions & 20 deletions apps/hello/README.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,3 @@
# Writer Framework app

## Editing the project

```bash
poetry install
poetry run writer edit .
```

## Running the project

```bash
poetry run writer run .
```

## Deploying the project

```bash
poetry run writer deploy .
```
This app was created using Writer Framework.

To learn more about it, visit https://developer.writer.com/framework
3 changes: 3 additions & 0 deletions apps/product-description-generator/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
This app was created using Writer Framework.

To learn more about it, visit https://developer.writer.com/framework
17 changes: 17 additions & 0 deletions apps/product-description-generator/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import writer as wf
import writer.ai
from prompts import base_prompts, seo_keywords, user_prompt

# This is the base template for the Product Description Generator tutorial.
# More documentation is available at https://developer.writer.com/framework

# Initialize state here
wf.init_state({
"form": {
"title": "",
"description": "",
"keywords": ""
},
"message": "Fill in the inputs and click \"Generate\" to get started.",
})

66 changes: 66 additions & 0 deletions apps/product-description-generator/prompts.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# BASE PROMPTS (TAILORED TO EACH COMPANY)

base_prompts = {}

base_prompts["Testco"] = """
System Instruction: Create enticing product description pages for Saturn Snacking products to be featured on the Testco supermarket website in the UK. Utilize the provided data fields to ensure each description is comprehensive and tailored to the Saturn Snacking brand. The aim is to make these product offerings more attractive to customers, thereby increasing purchases.
Prompt Details: Use the provided input data:
{title}
{description}
to generate detailed and enticing product descriptions.
"""

base_prompts["SuperEats"] = """
System Instruction: Create enticing product description pages for Saturn Snacking products to be featured on the Super Eats platform, which is an online platform usually accessed via mobile phones. Utilize the provided data fields to ensure each description is comprehensive and tailored to the Saturn Snacking brand. The aim is to make these product offerings more attractive to customers, thereby increasing purchases.
The description should be engaging, informative, and limited to a maximum of three sentences. This brief format should be suitable for customers browsing on the Super Eats platform, providing them with enough information to make an informed choice quickly.
Prompt Details: Use the provided input data:
{title}
{description}
to generate one compact and enticing product description.
"""

base_prompts["Midl"] = """
System Instruction: Create enticing product description pages for Saturn Snacking products to be featured on the Midl discount supermarket from Germany. Utilize the provided data fields to ensure each description is comprehensive and tailored to the Saturn Snacking brand. The aim is to make these product offerings more attractive to customers, thereby increasing purchases.
Prompt Details: Use the provided input data:
{title}
{description}
to generate compact and enticing product descriptions.
"""

### SEO KEYWORD PROMPT
seo_keywords = """
System Instruction: Analyze a group of product descriptions and identify the SEO keywords that are most frequently used. This analysis will help in understanding the common themes and keywords that are essential for optimizing the product descriptions for search engines.
Prompt Details: Examine the following product descriptions and identify the SEO keywords that are most frequently used.
{descriptions}
Provide Plotly.js graph specification that includes a JSON dictionary of the top 10 keywords and the number of times they appear in the descriptions. The graph should be visually appealing and easy to interpret, highlighting the most relevant keywords. Use #5551ff as the color for the bars in the graph.
"""

# USER PROMPT TEMPLATE
user_prompt = """
System Instruction: Create enticing product description pages for Saturn Snacking products to be featured on the {name} supermarket website. Utilize the provided data fields to ensure each description is comprehensive and tailored to the Saturn Snacking brand. The aim is to make these product offerings more attractive to customers, thereby increasing purchases.
Prompt Details: Use the provided input data:
{title}
{description}
to generate detailed and enticing product descriptions. Ensure the description is no longer than {character_max} characters.
"""
15 changes: 15 additions & 0 deletions apps/product-description-generator/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
[tool.poetry]
name = "writer-framework-default"
version = "0.1.0"
description = ""
authors = ["Your Name <[email protected]>"]
readme = "README.md"

[tool.poetry.dependencies]
python = "^3.10.0"
writer = {version = "^0.6.0"}


[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"
8 changes: 8 additions & 0 deletions apps/product-description-generator/static/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Serving static files

You can use this folder to store files which will be served statically in the "/static" route.

This is useful to store images and other files which will be served directly to the user of your application.

For example, if you store an image named "myimage.jpg" in this folder, it'll be accessible as "static/myimage.jpg".
You can use this relative route as the source in an Image component.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 5751030

Please sign in to comment.