https://github.com/slevin48/ami
Artificial Market Intelligence App 🤖
https://github.com/slevin48/ami
openai streamlit
Last synced: about 2 months ago
JSON representation
Artificial Market Intelligence App 🤖
- Host: GitHub
- URL: https://github.com/slevin48/ami
- Owner: slevin48
- License: mit
- Created: 2023-11-12T20:21:45.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-05-09T01:00:17.000Z (about 2 years ago)
- Last Synced: 2025-02-24T10:25:46.228Z (over 1 year ago)
- Topics: openai, streamlit
- Language: Python
- Homepage: https://conseil-dami.streamlit.app/
- Size: 43.5 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Artificial Market Intelligence 🤖
https://github.com/slevin48/ami/assets/12418115/6d12b2dd-b349-48be-bdf9-4efafae4e0bf
## Summary
```python
def summarize(text):
inst = '''Resume l'article suivant en moins de 1000 caracteres:'''
completion = openai.chat.completions.create(
model='gpt-3.5-turbo-1106',
messages= [
{'role': 'system', 'content': inst },
{'role': 'user', 'content': text }]
)
return completion.choices[0].message.content
```
## Text to Speech
```python
def text_to_speech(text, voice='fable'):
speech_file_path = Path(f'podcast/{episode}/audio/' + article.replace('.txt', '.mp3'))
response = openai.audio.speech.create(
model="tts-1",
voice=voice,
input=summary
)
response.stream_to_file(speech_file_path)
return response.result
```
## Translation
[translate_log.txt](translate_log.txt) contains the log of the translation process:
```
Iteration 0: Les embauches de cadres marquent le pas mais résistent toujours.txt
Translation characters: 459
Translated title: The hiring of executives is slowing down but still holding steady.
Voice: alloy
Audio file saved to podcast\episode003\audio_en\The hiring of executives is slowing down but still holding steady..mp3
Iteration 1: Nikki Haley joue sa carte dans la primaire républicaine.txt
Translation characters: 629
Translated title: Nikki Haley is playing her hand in the Republican primary.
Voice: echo
Audio file saved to podcast\episode003\audio_en\Nikki Haley is playing her hand in the Republican primary..mp3
Iteration 2: Nucléaire - les petits réacteurs essuient un revers aux Etats-Unis.txt
Translation characters: 465
Translated title: Nuclear - small reactors suffer a setback in the United States
Voice: fable
Audio file saved to podcast\episode003\audio_en\Nuclear - small reactors suffer a setback in the United States.mp3
Iteration 3: Présidentielle américaine 2024 - Donald Trump fait la course en tête.txt
Translation characters: 509
Translated title: 2024 American Presidential Election - Donald Trump in the lead
Voice: onyx
Audio file saved to podcast\episode003\audio_en\2024 American Presidential Election - Donald Trump in the lead.mp3
Iteration 4: Trump II - le mĂŞme en pire.txt
Translation characters: 525
Translated title: Trump II - the same but worse
Voice: nova
Audio file saved to podcast\episode003\audio_en\Trump II - the same but worse.mp3
Iteration 5: « Je suis devenu président grâce à ma marque », se vante Trump à son procès.txt
Translation characters: 488
Translated title: I became president because of my brand, boasts Trump at his trial.
Voice: shimmer
Audio file saved to podcast\episode003\audio_en\I became president because of my brand, boasts Trump at his trial..mp3
```
## Inspiration
https://github.com/slevin48/echos-TTS