# 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
with gr.Blocks(theme='bethecloud/storj_theme') as demo:
gr.HTML('')
gr.Markdown("""
Podcast World
Can be used to search and get recommended about podcasts, process newsletter insights over podcasts etc.
""")
with gr.Tabs():
# with gr.TabItem("Search Podcasts and get their RSS feeds"):
# with gr.Box():
# gr.Markdown(
# """
# ### Search Podcasts and get their RSS feeds
# """)
# with gr.Column():
# # normal_chatbot = gr.Chatbot()
# # normal_msg = gr.Textbox()
# # normal_clear = gr.Button("Clear")
# # normal_msg.submit(search_response, [normal_msg, normal_chatbot, dropdown], [normal_msg, normal_chatbot])
# # normal_clear.click(lambda: None, None, normal_chatbot_copilot, 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.Box():
# gr.Markdown(
# """
# ### Chat with GPT 3.5 with transcripts
# """)
# with gr.Column():
if __name__ == "__main__":
demo.queue(concurrency_count=1, api_open=False)
demo.launch(debug=True, share=False)