Update app.py
Browse files
app.py
CHANGED
@@ -41,8 +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 |
-
|
45 |
-
return data["choices"][0]["message"]["content"]
|
46 |
else:
|
47 |
# μ€λ₯ λ©μμ§ κ°μ
|
48 |
return f"μ€λ₯κ° λ°μνμ΅λλ€. μν μ½λ: {response.status_code}, λ©μμ§: {response.json().get('error', {}).get('message', 'Unknown error')}", ""
|
@@ -77,12 +76,9 @@ def summarize_text(contents, OPENAI_API_KEY):
|
|
77 |
def summarize_youtube_videos(keyword, OPENAI_API_KEY):
|
78 |
urls = search_youtube_videos(keyword)
|
79 |
contents = get_transcript(urls)
|
80 |
-
summary = summarize_text(contents,OPENAI_API_KEY)
|
81 |
-
return summary
|
82 |
|
83 |
-
def summarize_button_click(keyword, OPENAI_API_KEY):
|
84 |
-
summary = summarize_youtube_videos(keyword, OPENAI_API_KEY)
|
85 |
-
return summary
|
86 |
|
87 |
|
88 |
with gr.Blocks(css="footer {visibility: hidden;}") as demo:
|
|
|
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')}", ""
|
|
|
76 |
def summarize_youtube_videos(keyword, OPENAI_API_KEY):
|
77 |
urls = search_youtube_videos(keyword)
|
78 |
contents = get_transcript(urls)
|
79 |
+
summary, _ = summarize_text(contents,OPENAI_API_KEY)
|
80 |
+
return summary,""
|
81 |
|
|
|
|
|
|
|
82 |
|
83 |
|
84 |
with gr.Blocks(css="footer {visibility: hidden;}") as demo:
|