Update app.py
Browse files
app.py
CHANGED
@@ -8,14 +8,14 @@ def process_video(url):
|
|
8 |
API_KEY = os.getenv('GEMINI_API_KEY')
|
9 |
|
10 |
if not API_KEY:
|
11 |
-
return "ERROR: GEMINI_API_KEYκ° μ€μ λμ§ μμμ΅λλ€."
|
12 |
|
13 |
worksheet = YouTubeWorksheet(API_KEY)
|
14 |
|
15 |
# μλ§ μΆμΆ
|
16 |
transcript = worksheet.get_transcript(url)
|
17 |
if not transcript:
|
18 |
-
return "μλ§μ μΆμΆν μ μμ΅λλ€."
|
19 |
|
20 |
# μν¬μνΈ μμ±
|
21 |
content = worksheet.create_worksheet(transcript)
|
@@ -25,18 +25,17 @@ def process_video(url):
|
|
25 |
|
26 |
return f"μν¬μνΈκ° μμ±λμμ΅λλ€. νμΌλͺ
: {output_file}", output_file
|
27 |
|
28 |
-
|
29 |
-
|
30 |
-
iface = gr.Interface(
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
description="YouTube μμμ μλ§μ μ΄μ©νμ¬ νμ΅ μν¬μνΈλ₯Ό μμ±ν©λλ€."
|
39 |
-
)
|
40 |
|
41 |
-
if __name__ ==
|
42 |
-
|
|
|
|
8 |
API_KEY = os.getenv('GEMINI_API_KEY')
|
9 |
|
10 |
if not API_KEY:
|
11 |
+
return "ERROR: GEMINI_API_KEYκ° μ€μ λμ§ μμμ΅λλ€. .env νμΌμ νμΈν΄μ£ΌμΈμ."
|
12 |
|
13 |
worksheet = YouTubeWorksheet(API_KEY)
|
14 |
|
15 |
# μλ§ μΆμΆ
|
16 |
transcript = worksheet.get_transcript(url)
|
17 |
if not transcript:
|
18 |
+
return "μλ§μ μΆμΆν μ μμ΅λλ€."
|
19 |
|
20 |
# μν¬μνΈ μμ±
|
21 |
content = worksheet.create_worksheet(transcript)
|
|
|
25 |
|
26 |
return f"μν¬μνΈκ° μμ±λμμ΅λλ€. νμΌλͺ
: {output_file}", output_file
|
27 |
|
28 |
+
def main():
|
29 |
+
# Gradio μΈν°νμ΄μ€ μ€ν
|
30 |
+
iface = gr.Interface(
|
31 |
+
fn=process_video,
|
32 |
+
inputs=[gr.Textbox(label="YouTube URLμ μ
λ ₯νμΈμ")],
|
33 |
+
outputs=[gr.Textbox(label="μ²λ¦¬ κ²°κ³Ό"), gr.File(label="μμ±λ μν¬μνΈ")],
|
34 |
+
title="YouTube νμ΅ μν¬μνΈ μμ±κΈ°",
|
35 |
+
description="YouTube μμμ μλ§μ μ΄μ©νμ¬ νμ΅ μν¬μνΈλ₯Ό μμ±ν©λλ€."
|
36 |
+
)
|
37 |
+
iface.launch(share=True)
|
|
|
|
|
38 |
|
39 |
+
if __name__ == '__main__':
|
40 |
+
load_dotenv()
|
41 |
+
main()
|