awacke1 commited on
Commit
4964f61
β€’
1 Parent(s): e09f106

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +56 -40
app.py CHANGED
@@ -447,7 +447,6 @@ def display_glossary_grid(roleplaying_glossary):
447
  "πŸƒ": lambda k: f"https://huggingface.co/spaces/awacke1/GraphicAINovel?q={quote(PromptPrefix)}{quote(k)}", # this url plus query!
448
  "πŸ“š": lambda k: f"https://huggingface.co/spaces/awacke1/GraphicAINovel?q={quote(PromptPrefix2)}{quote(k)}", # this url plus query!
449
  "πŸ“š": lambda k: f"https://huggingface.co/spaces/awacke1/GraphicAINovel?q={quote(PromptPrefix3)}{quote(k)}", # this url plus query!
450
-
451
  }
452
 
453
  for category, details in roleplaying_glossary.items():
@@ -460,7 +459,19 @@ def display_glossary_grid(roleplaying_glossary):
460
  links_md = ' '.join([f"[{emoji}]({url(term)})" for emoji, url in search_urls.items()])
461
  st.markdown(f"{term} {links_md}", unsafe_allow_html=True)
462
 
463
-
 
 
 
 
 
 
 
 
 
 
 
 
464
 
465
 
466
  game_emojis = {
@@ -558,25 +569,27 @@ def display_videos_and_links():
558
  st.video(video_file, format='video/mp4', start_time=0)
559
 
560
  # Display Wikipedia and Google search links
561
- keyword = video_file.split('.')[0] # Assumes keyword is the file name without extension
562
- wikipedia_url = create_search_url_wikipedia(keyword)
563
- google_url = create_search_url_google(keyword)
564
- youtube_url = create_search_url_youtube(keyword)
565
- bing_url = create_search_url_bing(keyword)
566
- ai_url = create_search_url_ai(keyword)
567
- ai_url2 = create_search_url_ai(keyword + ' ' + PromptPrefix)
568
- ai_url3 = create_search_url_ai(keyword + ' ' + PromptPrefix2)
569
- links_md = f"""
570
- [Wikipedia]({wikipedia_url}) |
571
- [Google]({google_url}) |
572
- [YouTube]({youtube_url}) |
573
- [Bing]({bing_url}) |
574
- [AI]({ai_url})|
575
- [AI Novel]({ai_url2} )|
576
- [AI Novel App]({ai_url3})
577
- """
578
- st.markdown(links_md)
579
- col_index += 1
 
 
580
 
581
 
582
  def display_images_and_wikipedia_summaries():
@@ -607,25 +620,28 @@ def display_images_and_wikipedia_summaries():
607
  st.image(image, caption=image_file, use_column_width=True)
608
 
609
  # Display Wikipedia and Google search links
610
- keyword = image_file.split('.')[0] # Assumes keyword is the file name without extension
611
- wikipedia_url = create_search_url_wikipedia(keyword)
612
- google_url = create_search_url_google(keyword)
613
- youtube_url = create_search_url_youtube(keyword)
614
- bing_url = create_search_url_bing(keyword)
615
- ai_url = create_search_url_ai(keyword)
616
- ai_url2 = create_search_url_ai(keyword + ' ' + PromptPrefix)
617
- ai_url3 = create_search_url_ai(keyword + ' ' + PromptPrefix2)
618
- links_md = f"""
619
- [Wikipedia]({wikipedia_url}) |
620
- [Google]({google_url}) |
621
- [YouTube]({youtube_url}) |
622
- [Bing]({bing_url}) |
623
- [AI]({ai_url})|
624
- [AI Novel]({ai_url2} )|
625
- [AI Novel App]({ai_url3})
626
- """
627
- st.markdown(links_md)
628
- col_index += 1
 
 
 
629
 
630
 
631
  def get_all_query_params(key):
 
447
  "πŸƒ": lambda k: f"https://huggingface.co/spaces/awacke1/GraphicAINovel?q={quote(PromptPrefix)}{quote(k)}", # this url plus query!
448
  "πŸ“š": lambda k: f"https://huggingface.co/spaces/awacke1/GraphicAINovel?q={quote(PromptPrefix2)}{quote(k)}", # this url plus query!
449
  "πŸ“š": lambda k: f"https://huggingface.co/spaces/awacke1/GraphicAINovel?q={quote(PromptPrefix3)}{quote(k)}", # this url plus query!
 
450
  }
451
 
452
  for category, details in roleplaying_glossary.items():
 
459
  links_md = ' '.join([f"[{emoji}]({url(term)})" for emoji, url in search_urls.items()])
460
  st.markdown(f"{term} {links_md}", unsafe_allow_html=True)
461
 
462
+ def display_glossary_entity(k):
463
+ search_urls = {
464
+ "πŸ“–": lambda k: f"https://en.wikipedia.org/wiki/{quote(k)}",
465
+ "πŸ”": lambda k: f"https://www.google.com/search?q={quote(k)}",
466
+ "▢️": lambda k: f"https://www.youtube.com/results?search_query={quote(k)}",
467
+ "πŸ”Ž": lambda k: f"https://www.bing.com/search?q={quote(k)}",
468
+ "🎲": lambda k: f"https://huggingface.co/spaces/awacke1/GraphicAINovel?q={quote(k)}", # this url plus query!
469
+ "πŸƒ": lambda k: f"https://huggingface.co/spaces/awacke1/GraphicAINovel?q={quote(PromptPrefix)}{quote(k)}", # this url plus query!
470
+ "πŸ“š": lambda k: f"https://huggingface.co/spaces/awacke1/GraphicAINovel?q={quote(PromptPrefix2)}{quote(k)}", # this url plus query!
471
+ "πŸ“š": lambda k: f"https://huggingface.co/spaces/awacke1/GraphicAINovel?q={quote(PromptPrefix3)}{quote(k)}", # this url plus query!
472
+ }
473
+ links_md = ' '.join([f"[{emoji}]({url(k)})" for emoji, url in search_urls.items()])
474
+ st.markdown(f"{k} {links_md}", unsafe_allow_html=True)
475
 
476
 
477
  game_emojis = {
 
569
  st.video(video_file, format='video/mp4', start_time=0)
570
 
571
  # Display Wikipedia and Google search links
572
+ k = video_file.split('.')[0] # Assumes keyword is the file name without extension
573
+ display_glossary_entity(k)
574
+
575
+ #wikipedia_url = create_search_url_wikipedia(keyword)
576
+ #google_url = create_search_url_google(keyword)
577
+ #youtube_url = create_search_url_youtube(keyword)
578
+ #bing_url = create_search_url_bing(keyword)
579
+ #ai_url = create_search_url_ai(keyword)
580
+ #ai_url2 = create_search_url_ai(keyword + ' ' + PromptPrefix)
581
+ #ai_url3 = create_search_url_ai(keyword + ' ' + PromptPrefix2)
582
+ #links_md = f"""
583
+ #[Wikipedia]({wikipedia_url}) |
584
+ #[Google]({google_url}) |
585
+ #[YouTube]({youtube_url}) |
586
+ #[Bing]({bing_url}) |
587
+ #[AI]({ai_url})|
588
+ #[AI Novel]({ai_url2} )|
589
+ #[AI Novel App]({ai_url3})
590
+ #"""
591
+ #st.markdown(links_md)
592
+ #col_index += 1
593
 
594
 
595
  def display_images_and_wikipedia_summaries():
 
620
  st.image(image, caption=image_file, use_column_width=True)
621
 
622
  # Display Wikipedia and Google search links
623
+ k = image_file.split('.')[0] # Assumes keyword is the file name without extension
624
+
625
+ display_glossary_entity(k)
626
+
627
+ #wikipedia_url = create_search_url_wikipedia(keyword)
628
+ #google_url = create_search_url_google(keyword)
629
+ #youtube_url = create_search_url_youtube(keyword)
630
+ #bing_url = create_search_url_bing(keyword)
631
+ #ai_url = create_search_url_ai(keyword)
632
+ #ai_url2 = create_search_url_ai(keyword + ' ' + PromptPrefix)
633
+ #ai_url3 = create_search_url_ai(keyword + ' ' + PromptPrefix2)
634
+ #links_md = f"""
635
+ #[Wikipedia]({wikipedia_url}) |
636
+ #[Google]({google_url}) |
637
+ #[YouTube]({youtube_url}) |
638
+ #[Bing]({bing_url}) |
639
+ #[AI]({ai_url})|
640
+ #[AI Novel]({ai_url2} )|
641
+ #[AI Novel App]({ai_url3})
642
+ #"""
643
+ #st.markdown(links_md)
644
+ #col_index += 1
645
 
646
 
647
  def get_all_query_params(key):