Skip to content

Commit

Permalink
Update to 4.0.2
Browse files Browse the repository at this point in the history
  • Loading branch information
FlorianJacta committed Jan 30, 2025
1 parent 472a06d commit 8e4c64a
Show file tree
Hide file tree
Showing 8 changed files with 1,534 additions and 45 deletions.
13 changes: 2 additions & 11 deletions INSTALLATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,7 @@

```
git clone https://github.com/Avaiga/demo-tweet-generation.git
cd demo-sales dashboard
cd demo-tweet-generation
cd src
pip install -r requirements.txt
```

If you want to run tests, please install `Pipenv`:
```
pip install pipenv
git clone https://github.com/Avaiga/demo-tweet-generation.git
cd demo-tweet-generation
pipenv install --dev
pipenv run pytest
```
```
27 changes: 0 additions & 27 deletions Pipfile

This file was deleted.

1 change: 1 addition & 0 deletions src/.python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.11
11 changes: 8 additions & 3 deletions src/main_markdown.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ def on_exception(state, function_name: str, ex: Exception):
## "text" here is just a name given to my part/my section
## it has no meaning in the code
page = """
<|toggle|theme|>
<|container|
# **Tweet**{: .color-primary} Generation
Expand Down Expand Up @@ -183,12 +184,16 @@ def on_exception(state, function_name: str, ex: Exception):
<|{tweet}|input|multiline|label=Resulting tweet|class_name=fullwidth|>
<center><|Generate image|button|on_action=generate_image|label=Generate image|active={prompt!="" and tweet!=""}|></center>
<center>
<|Generate image|button|on_action=generate_image|label=Generate image|active={prompt!="" and tweet!=""}|>
</center>
<image|part|render={prompt != "" and tweet != "" and image is not None}|class_name=card|
### **Image**{: .color-primary} from Dall-e
<center><|{image}|image|height=400px|></center>
<center>
<|{image}|image|height=400px|>
</center>
|image>
<br/>
Expand All @@ -199,4 +204,4 @@ def on_exception(state, function_name: str, ex: Exception):
|>
"""

Gui(page).run(title='Tweet Generation', debug=True, port=2436)
Gui(page).run(title='Tweet Generation', debug=True, port=2436, dark_mode=True)
7 changes: 4 additions & 3 deletions src/main_tgb.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ def on_exception(state, function_name: str, ex: Exception):


with tgb.Page() as page:
tgb.toggle(theme=True)
with tgb.part("container"):
tgb.text("# Tweet Generation", mode="md")
tgb.text("This mini-app generates Tweets using OpenAI's GPT-3 based [Davinci model](https://beta.openai.com/docs/models/overview) for texts and [DALL·E](https://beta.openai.com/docs/guides/images) for images.", mode="md")
Expand All @@ -163,13 +164,13 @@ def on_exception(state, function_name: str, ex: Exception):
tgb.text("## Generated Tweets", mode="md")
tgb.input("{tweet}", multiline=True, label="Resulting tweet", class_name="fullwidth")

tgb.button("Generate image", on_action=generate_image, active="{prompt != '' and tweet != ''}", class_name="text-center text_center center")
tgb.button("Generate image", on_action=generate_image, active=lambda prompt, tweet: prompt != '' and tweet != '', class_name="text-center text_center center")

with tgb.part(render="{prompt != '' and tweet != '' and image is not None}", class_name="card text-center"):
with tgb.part(render=lambda prompt, tweet, image: prompt != '' and tweet != '' and image is not None, class_name="card text-center"):
tgb.text("## Image from Dall-e", mode="md")
tgb.image("{image}", height="400px")

tgb.text("Code from [@kinosal](https://twitter.com/kinosal)", mode="md")
tgb.text("Original code can be found [here](https://github.com/kinosal/tweet)", mode="md")

Gui(page).run(title='Tweet Generation', port=3455)
Gui(page).run(title='Tweet Generation', port=3455, dark_mode=True)
10 changes: 10 additions & 0 deletions src/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[project]
name = "src"
version = "0.1.0"
description = "Add your description here"
readme = "README.md"
requires-python = ">=3.11"
dependencies = [
"openai>=1.60.2",
"taipy==4.0.2",
]
2 changes: 1 addition & 1 deletion src/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
taipy==3.1
taipy==4.0.2
openai
1,508 changes: 1,508 additions & 0 deletions src/uv.lock

Large diffs are not rendered by default.

0 comments on commit 8e4c64a

Please sign in to comment.