File size: 6,568 Bytes
ed050a6
 
 
 
 
 
 
 
 
 
 
 
 
0c85c33
448cd31
b968b38
ed050a6
 
428d651
ed050a6
 
 
 
f41ed1c
319a629
ed050a6
 
 
 
448cd31
a8036bd
 
 
 
 
 
 
0c85c33
 
 
 
 
 
ed050a6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
474d389
a8036bd
 
 
 
 
 
0c85c33
 
 
 
 
 
 
 
a8036bd
0c85c33
a8036bd
0c85c33
 
 
 
 
a8036bd
0c85c33
 
a8036bd
0c85c33
 
 
 
 
 
 
 
 
 
 
 
 
 
474d389
ed050a6
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
# This is a sample Python script.

# Press ⌃R to execute it or replace it with your code.
# Press Double ⇧ to search everywhere for classes, files, tool windows, actions, and settings.
import gradio as gr
import time
import random
import math

import pandas as pd
import openai
import os
from display_json import get_podcast
from invoke_rss import get_rss_output, get_recommendations
from search_recommend import search_chat_respond



with gr.Blocks(theme='bethecloud/storj_theme', css=".gradio-container {background: url('file=image.png');background-size: cover}") as demo:
    gr.Markdown("""
  <div style= "display:block;
                  align-items: center;
                  gap: 0.8rem;">
   <h1 style='text-align: center; color:orange'> <img src="file/logo.png" alt="Podcaster" style="height: 80px; width:100px; flex: 0 0 auto; margin-right: 100px;"> PodcastPulse: Unveiling Insights </h1>
  <h2 style='text-align: center;color:yellow'>Can be used to search and get recommended about podcasts, process newsletter insights over podcasts etc.</h2>
  
  </div>
  """)
    with gr.Tabs():
        with gr.TabItem("Search Podcasts and get their RSS feeds"):
            with gr.Accordion("Open for Search"):
                with gr.Box():
                    gr.Markdown(
                        """
                        ### Search Podcasts and get their RSS feeds -- Currently Not Enabled as ListenNotes only offers limited free API calls/month 
                        """)
                    
                    with gr.Column():
                        normal_chatbot = gr.Chatbot()
                        normal_msg = gr.Textbox()
                        normal_clear = gr.Button("Clear")
                        normal_msg.submit(search_chat_respond, [normal_msg, normal_chatbot], [normal_msg, normal_chatbot])
                        normal_clear.click(lambda: None, None, normal_chatbot, queue=False)

        with gr.TabItem("PreProcessed Podcasts"):
            with gr.Box():
                gr.Markdown(
                    """
                    ### PreProcessed Podcasts
                    """)
                with gr.Column():
                    dropdown_few = gr.Dropdown(["In Machines We trust - MIT",
                                                "TWIML",
                                                ],
                                               label="Select Podcast")
                    btn = gr.Button("See")
                    with gr.Row().style(equal_height=True):
                        Title = gr.Textbox(label="Title")
                        Episode_Name = gr.Textbox(label="Episode Name")
                        Episode_Image = gr.Image(label="Episode Image")

                    podcast_summary = gr.Textbox(label="Summary")

                    with gr.Row().style(equal_height=True):
                        podcast_guest = gr.Textbox(label="podcast guest")
                        podcast_guest_org = gr.Textbox(label="Podcast Guest Organization")
                        podcast_guest_title = gr.Textbox(label="Guest Title")
                        podcast_guest_wikipedia = gr.Textbox(label="Guest Wikipedia Info")

                    podcast_highlights = gr.Textbox(label="Highlights")
                    podcast_key_moments = gr.Textbox(label="Key Moments and Key Topics")

                    with gr.Accordion("Open for Full Dialog Transcript"):
                        podcast_gpt_transcript = gr.Textbox()

                    btn.click(fn=get_podcast, inputs=dropdown_few, outputs=[Title,Episode_Name,Episode_Image,podcast_summary,  podcast_guest, podcast_guest_org, \
               podcast_guest_title, podcast_guest_wikipedia,podcast_highlights, podcast_key_moments, \
               podcast_gpt_transcript])


        with gr.TabItem("Process New Podcast using RSS feed"):
            with gr.Accordion("Open to process insights on a Podcast"):
                with gr.Box():
                    gr.Markdown(
                        """
                        ### Get details related to an RSS feed --Currently diabled due to OpenAI rate cost issues do ping me on slack if you wanna check something out
                        """)
                    with gr.Column():
                        #rss_feed = gr.Textbox(label="Enter Rss Feed here")
                        podcast_id_text = gr.Textbox(label="Enter Podcast ID here")
                        # btn_2 = gr.Button("See")
                        # with gr.Row().style(equal_height=True):
                        #     Title_2 = gr.Textbox(label="Title")
                        #     Episode_Name_2 = gr.Textbox(label="Episode Name")
                        #     Episode_Image_2 = gr.Image(label="Episode Image")
    
                        # podcast_summary_2 = gr.Textbox(label="Summary")
    
                        # with gr.Row().style(equal_height=True):
                        #     podcast_guest_2 = gr.Textbox(label="podcast guest")
                        #     podcast_guest_org_2 = gr.Textbox(label="Podcast Guest Organization")
                        #     podcast_guest_title_2 = gr.Textbox(label="Guest Title")
                        #     podcast_guest_wikipedia_2 = gr.Textbox(label="Guest Wikipedia Info")
    
                        # podcast_highlights_2 = gr.Textbox(label="Highlights")
                        # podcast_key_moments_2 = gr.Textbox(label="Key Moments and Key Topics")
    
                        # with gr.Accordion("Open for Full Dialog Transcript"):
                        #     podcast_gpt_transcript_2 = gr.Textbox()

                        recommend_chatbot = gr.Chatbot(label="See recommendations here")
                        btn_recommend = gr.Button("Get Recommendations")

                        # btn_2.click(fn=get_rss_output, inputs=rss_feed,
                        #           outputs=[Title_2, Episode_Name_2, Episode_Image_2, podcast_summary_2, podcast_guest_2,
                        #                    podcast_guest_org_2, \
                        #                    podcast_guest_title_2, podcast_guest_wikipedia_2, podcast_highlights_2,
                        #                    podcast_key_moments_2, \
                        #                    podcast_gpt_transcript_2])

                        btn_recommend.click(fn=get_recommendations, inputs=[podcast_id_text,recommend_chatbot], outputs= recommend_chatbot)








if __name__ == "__main__":


    demo.queue(concurrency_count=1, api_open=False)
    demo.launch(debug=True, share=False)