Update app.py
Browse files
app.py
CHANGED
@@ -41,7 +41,7 @@ def summarize_text(contents, OPENAI_API_KEY):
|
|
41 |
response = requests.post(API_URL, headers=headers, json=payload)
|
42 |
if response.status_code == 200:
|
43 |
data = response.json()
|
44 |
-
return data["choices"][0]["message"]["content"]
|
45 |
else:
|
46 |
# μ€λ₯ λ©μμ§ κ°μ
|
47 |
return f"μ€λ₯κ° λ°μνμ΅λλ€. μν μ½λ: {response.status_code}, λ©μμ§: {response.json().get('error', {}).get('message', 'Unknown error')}", ""
|
@@ -83,7 +83,7 @@ def summarize_youtube_videos(keyword, OPENAI_API_KEY):
|
|
83 |
urls = search_youtube_videos(keyword)
|
84 |
contents = get_transcript(urls)
|
85 |
summary, _ = summarize_text(contents, OPENAI_API_KEY)
|
86 |
-
return summary
|
87 |
|
88 |
|
89 |
with gr.Blocks(css="footer {visibility: hidden;}") as demo:
|
@@ -98,7 +98,7 @@ with gr.Blocks(css="footer {visibility: hidden;}") as demo:
|
|
98 |
analysis_btn.click(
|
99 |
fn=summarize_youtube_videos,
|
100 |
inputs=[keyword, OPENAI_API_KEY],
|
101 |
-
outputs=[
|
102 |
)
|
103 |
|
104 |
demo.launch()
|
|
|
41 |
response = requests.post(API_URL, headers=headers, json=payload)
|
42 |
if response.status_code == 200:
|
43 |
data = response.json()
|
44 |
+
return data["choices"][0]["message"]["content"]
|
45 |
else:
|
46 |
# μ€λ₯ λ©μμ§ κ°μ
|
47 |
return f"μ€λ₯κ° λ°μνμ΅λλ€. μν μ½λ: {response.status_code}, λ©μμ§: {response.json().get('error', {}).get('message', 'Unknown error')}", ""
|
|
|
83 |
urls = search_youtube_videos(keyword)
|
84 |
contents = get_transcript(urls)
|
85 |
summary, _ = summarize_text(contents, OPENAI_API_KEY)
|
86 |
+
return summary
|
87 |
|
88 |
|
89 |
with gr.Blocks(css="footer {visibility: hidden;}") as demo:
|
|
|
98 |
analysis_btn.click(
|
99 |
fn=summarize_youtube_videos,
|
100 |
inputs=[keyword, OPENAI_API_KEY],
|
101 |
+
outputs=[analysis_result]
|
102 |
)
|
103 |
|
104 |
demo.launch()
|