Skip to content

Commit

Permalink
Using Gemini to tag and caption images (#195)
Browse files Browse the repository at this point in the history
* Reformat notebook

* Reformat notebook

* Update notebook with shorter prompt

* Adding text classification JSON example

* Add example for tagging and captioning images

* Reformat basic code generation

* Update text classificaiton

* Update text classificaiton

* Update notebook and reformat
  • Loading branch information
shilpakancharla committed Jun 18, 2024
1 parent ea90527 commit dc168d9
Show file tree
Hide file tree
Showing 2 changed files with 1,673 additions and 11 deletions.
1,633 changes: 1,633 additions & 0 deletions examples/Tag_and_caption_images.ipynb

Large diffs are not rendered by default.

51 changes: 40 additions & 11 deletions examples/json_capabilities/Text_Classification.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
},
{
"cell_type": "code",
"execution_count": 2,
"execution_count": 1,
"metadata": {
"id": "Ne-3gnXqR0hI"
},
Expand All @@ -84,7 +84,7 @@
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": 2,
"metadata": {
"id": "EconMHePQHGw"
},
Expand All @@ -110,7 +110,7 @@
},
{
"cell_type": "code",
"execution_count": 4,
"execution_count": 3,
"metadata": {
"id": "v-JZzORUpVR2"
},
Expand All @@ -133,18 +133,26 @@
},
{
"cell_type": "code",
"execution_count": 5,
"execution_count": 4,
"metadata": {
"id": "d7vfQVmt9uUT"
},
"outputs": [
{
"data": {
"text/markdown": "## The Power of Sport: More Than Just a Game\n\nThe roar of the crowd, the thrill of victory, the agony of defeat – sports have a captivating power that transcends the boundaries of the playing field. From the meticulously choreographed dances of figure skating to the raw intensity of a football game, sports evoke emotions that run deep, uniting people from all walks of life. But beyond the entertainment value, sport plays a crucial role in shaping our society, promoting physical and mental well-being, and fostering a sense of community. \n\nThe undeniable physical benefits of sport are widely recognized. Regular participation in physical activities strengthens the body, improves cardiovascular health, and reduces the risk of chronic diseases. However, the benefits extend far beyond the physical. Studies have shown that sport can have a profound impact on mental health, reducing stress, anxiety, and depression. By encouraging teamwork, discipline, and perseverance, sports instill valuable life lessons that extend beyond the playing field.\n\nThe unifying power of sport transcends language, culture, and even political divides. Shared passions for a team or an athlete create a sense of belonging, fostering friendships and strengthening bonds within communities. The global appeal of major sporting events, such as the Olympics or the World Cup, demonstrates the universal language of sportsmanship and the ability to bring people together in a shared celebration of human achievement. \n\nThis unifying power of sport can be particularly important in addressing pressing societal issues. The \"Peace and Sport\" organization, for example, leverages the power of sport to promote peace and reconciliation in conflict zones. By providing access to sporting opportunities, the organization empowers individuals and communities to rebuild their lives and foster a sense of hope for the future.\n\nSports hold the potential to empower, inspire, and transform individuals and communities. From promoting physical and mental well-being to fostering social cohesion and addressing societal challenges, the power of sport extends far beyond the playing field. As we navigate an increasingly complex and interconnected world, the unifying and transformative power of sports will continue to play a vital role in shaping our future. \n",
"text/plain": [
"<IPython.core.display.Markdown object>"
]
},
"text/markdown": [
"## The Power of Sport: A Catalyst for Social Change\n",
"\n",
"Sports have long been a source of entertainment and inspiration, captivating audiences worldwide with their thrilling competitions and captivating narratives. But beyond the cheers and the victories, sports hold a profound power to drive social change. From promoting gender equality to fostering cross-cultural understanding, the impact of sports extends far beyond the playing field.\n",
"\n",
"One of the most significant ways sports can contribute to social change is by challenging societal norms and promoting inclusivity. The rise of female athletes in traditionally male-dominated sports has shattered stereotypes and empowered women to pursue their athletic dreams. Similarly, the increasing visibility of athletes from diverse backgrounds has helped to break down racial and cultural barriers, fostering a more inclusive and equitable society.\n",
"\n",
"Furthermore, sports can serve as a powerful tool for promoting peace and understanding. International sporting events, such as the Olympics, bring together athletes and spectators from all corners of the globe, fostering a sense of unity and shared humanity. These events can transcend political and cultural differences, creating a platform for dialogue and cooperation.\n",
"\n",
"However, the potential of sports to drive social change is not without its challenges. Issues such as discrimination, corruption, and the exploitation of athletes continue to plague the sporting world. It is crucial to address these issues head-on, ensuring that sports remain a force for good and a platform for positive change.\n",
"\n",
"In conclusion, sports hold immense potential to drive social change, promoting inclusivity, fostering peace, and challenging societal norms. By embracing the power of sports and addressing its challenges, we can harness its transformative potential to create a more just and equitable world. As we celebrate the triumphs and the struggles of athletes on the field, let us also recognize the profound impact they have on society as a whole. \n"
],
"execution_count": 5,
"metadata": {},
"output_type": "execute_result"
Expand Down Expand Up @@ -195,11 +203,32 @@
"text": [
"{\n",
" \"topics\": [\n",
" \"topic\": \"Gender Equality\",\n",
" \"relevance\": 0.6\n",
" },\n",
" {\n",
" \"topic\": \"Sports\",\n",
" \"relevance\": 0.8\n",
" \"topic\": \"Inclusivity\",\n",
" \"relevance\": 0.6\n",
" },\n",
" {\n",
" \"topic\": \"Peace\",\n",
" \"relevance\": 0.5\n",
" },\n",
" {\n",
" \"topic\": \"Cultural Understanding\",\n",
" \"relevance\": 0.5\n",
" },\n",
" {\n",
" \"topic\": \"Discrimination\",\n",
" \"relevance\": 0.4\n",
" },\n",
" {\n",
" \"topic\": \"Corruption\",\n",
" \"relevance\": 0.4\n",
" },\n",
" {\n",
" \"topic\": \"Exploitation\",\n",
" \"relevance\": 0.4\n",
" \"topic\": \"Health\",\n",
" \"relevance\": 0.6\n",
" },\n",
Expand Down

0 comments on commit dc168d9

Please sign in to comment.