-
-
You are stronger than you think.
-
Your determination will open doors.
-
The harder you work, the luckier you get.
-
Let your instincts guide you.
-
Happiness comes from within, not from others.
-
Every day is a new beginning.
-
The greatest lessons come from challenges.
-
The journey of a thousand miles begins with a single step.
-
screenshot of 2 test runs
Inspiration
I got inspiration for this project from the Linux command "fortune"
What it does
This project randomly picks one of 100 inspirational quotes and gives it to a text to image API called Deep AI and then spits out the quote and the image
How I built it
I built this code on 5 base libraries. The random library, that is needed to randomize the fortune quotes, the requests library that is needed to make the random fortune quote into an ai image, the urllib library, that is needed to retrieve the api image from the cloud onto my local drive, the pillow library that is needed to open the image on my computer, and finally, the os library that is used for OS related libraries such as directory parsing.
Challenges I ran into
Some challenges that I ran into was that every time that I wanted to call on the Deep ai, I had to pay 5 cents. To solve this problem, I implemented cache to my code where it would find if I had the quote's image on my computer, and if I did, it wouldn't reach to the cloud to get a new picture, but get the picture in my files. If I didn't have it saved on my files, then it would reach to the cloud and get the image from the api, then it would save it to my files. I also ran into the problem that if I posted the code with my API key signature, people could use the API for free, but charge me. My solution to the second problem, is that I hid my access key under the variable "token" I put the key in a file, and then open the file in the script, and putting the key into the variable token.
Accomplishments that I'm proud of
I am proud of figuring out how to implement cache to my code and I am proud that I was able to access an API for the first time. I have taken coursera classes on python. I was very happy to use the knowledge about lists, dictionary, urllib in implementing this project.
What I learned
During the project, I learned how to implement api's into my code, how to access pictures from the cloud in python, and how cache works.
What's next for Daily Fortune using Generative image
Right now, the AI text to image generators are pretty glitchy. It will improve in their next revisions. But my code can remain the same since it will use the same APIs and the logic is the same. In the future I am planning to find new text to image api's and compare which ones are better, then I can change my code to use the better api.
Built With
- cloud
- deepai
- python
- txt2img
Log in or sign up for Devpost to join the conversation.