Inspiration
We were interested in learning more about NLP so we set out to learn more about a a NLP API. Thus, we decided to get comfortable with Cohere.
What it does
The application asks for three inputs: The prompt (or context of the story), the character's name and the genre of the story. It then generates a short story (of 4-5 lines) using all three user inputs.
How we built it
We made use of the Cohere API and the generate function that exists in the API. This generated a story according to the prompt engineering that we gave to the API. The function that generates the text is quite short:
def generate_text(base_prompt, current_prompt):
response = co.generate(
model='xlarge',
prompt = base_prompt + current_prompt,
max_tokens=300,
temperature=5,
stop_sequences=[".\n\n"])
generation = response.generations[0].text
return generation
It uses the examples that we gave it to create a same kind of short story but with the user's input. We then deployed the application on Flask in order to run a quick web app.
Challenges we ran into
We ran into a few problems since we don't have any experience in AI. So it took us around 4 hours to understand and install Cohere properly. But since the API is so simple to use, generating the text was actually the easiest thing in the project. The other biggest challenge was to develop a backend part of the web app using Flask and trying to link everything together.
Accomplishments that we're proud of
We're really proud to have finally introduced ourselves to AI and having done a project with it on our own. We're also proud that the application works as we wished it.
What we learned
We learned python. Believe it or not, most of our team had little to no experience coding in python and so we had to learn that along the way. We also learned how to integrate and install API's into our project and especially we learned how to deploy a Flask Web Application.
What's next for Discotime
Hopefully more learning and hacking:) We're really happy that MAIS was our first experience at a hackathon because it was definitely a positive one. We're excited to participate in other hackathons in the future and hopefully to dive into the world of AI a little deeper next time.
Log in or sign up for Devpost to join the conversation.