Update app.py
Browse files
app.py
CHANGED
@@ -3,7 +3,7 @@ import gradio as gr # Added import statement for Gradio
|
|
3 |
import openai
|
4 |
import os
|
5 |
|
6 |
-
openai.api_key = os.getenv('O_API_KEY')
|
7 |
|
8 |
def search_youtube_videos(keyword):
|
9 |
videos_search = VideosSearch(keyword, limit=5)
|
@@ -52,19 +52,38 @@ def summarize_youtube_videos(keyword):
|
|
52 |
summary = summarize_text(contents)
|
53 |
return summary
|
54 |
|
55 |
-
# Define Gradio interface
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
56 |
iface = gr.Interface(
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
fn = summarize_youtube_videos,
|
63 |
-
inputs = [input, OPEN_API_KEY],
|
64 |
-
outputs = [output]
|
65 |
-
),
|
66 |
title="Summarize YouTube Videos",
|
67 |
-
description="Enter a keyword to summarize related YouTube videos."
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
68 |
|
69 |
# Launch Gradio interface
|
70 |
iface.launch()
|
|
|
3 |
import openai
|
4 |
import os
|
5 |
|
6 |
+
# openai.api_key = os.getenv('O_API_KEY')
|
7 |
|
8 |
def search_youtube_videos(keyword):
|
9 |
videos_search = VideosSearch(keyword, limit=5)
|
|
|
52 |
summary = summarize_text(contents)
|
53 |
return summary
|
54 |
|
55 |
+
# # Define Gradio interface
|
56 |
+
# iface = gr.Interface(
|
57 |
+
# input = gr.Textbox(label="keyword", placeholder='ํค์๋๋ฅผ ์
๋ ฅํ์ธ์. (์.๋นํธ์ฝ์ธ)'),
|
58 |
+
# OPENAI_API_KEY = gr.Textbox(label="OpenAI API ํค", placeholder="์ฌ๊ธฐ์ OpenAI API ํค๋ฅผ ์
๋ ฅํ์ธ์"),
|
59 |
+
# output =gr.JSON(label='์ ํ๋ธ 5๊ฐ ์์ฝ ๊ฒฐ๊ณผ'),
|
60 |
+
# result = gr.Button('submit'),
|
61 |
+
# result.click(
|
62 |
+
# fn = summarize_youtube_videos,
|
63 |
+
# inputs = [input, OPEN_API_KEY],
|
64 |
+
# outputs = [output]
|
65 |
+
# ),
|
66 |
+
# title="Summarize YouTube Videos",
|
67 |
+
# description="Enter a keyword to summarize related YouTube videos.")
|
68 |
+
|
69 |
+
# # Launch Gradio interface
|
70 |
+
# iface.launch()
|
71 |
+
|
72 |
iface = gr.Interface(
|
73 |
+
inputs=[
|
74 |
+
gr.Textbox(label="keyword", placeholder='ํค์๋๋ฅผ ์
๋ ฅํ์ธ์. (์.๋นํธ์ฝ์ธ)'),
|
75 |
+
gr.Textbox(label="OpenAI API ํค", placeholder="์ฌ๊ธฐ์ OpenAI API ํค๋ฅผ ์
๋ ฅํ์ธ์")
|
76 |
+
],
|
77 |
+
outputs=gr.JSON(label='์ ํ๋ธ 5๊ฐ ์์ฝ ๊ฒฐ๊ณผ'),
|
|
|
|
|
|
|
|
|
78 |
title="Summarize YouTube Videos",
|
79 |
+
description="Enter a keyword to summarize related YouTube videos."
|
80 |
+
)
|
81 |
+
|
82 |
+
def summarize_button_click(keyword, OPENAI_API_KEY):
|
83 |
+
summary = summarize_youtube_videos(keyword, OPENAI_API_KEY)
|
84 |
+
return summary
|
85 |
+
|
86 |
+
iface.button("submit", summarize_button_click)
|
87 |
|
88 |
# Launch Gradio interface
|
89 |
iface.launch()
|