JUNGU commited on
Commit
1a84c5a
β€’
1 Parent(s): 0b561dc

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -16
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κ°€ μ„€μ •λ˜μ§€ μ•Šμ•˜μŠ΅λ‹ˆλ‹€.", None
12
 
13
  worksheet = YouTubeWorksheet(API_KEY)
14
 
15
  # μžλ§‰ μΆ”μΆœ
16
  transcript = worksheet.get_transcript(url)
17
  if not transcript:
18
- return "μžλ§‰μ„ μΆ”μΆœν•  수 μ—†μŠ΅λ‹ˆλ‹€.", None
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
- # Gradio μΈν„°νŽ˜μ΄μŠ€ 생성
29
- load_dotenv()
30
- iface = gr.Interface(
31
- fn=process_video,
32
- inputs=[gr.Textbox(label="YouTube URL을 μž…λ ₯ν•˜μ„Έμš”", placeholder="https://www.youtube.com/watch?v=...")],
33
- outputs=[
34
- gr.Textbox(label="처리 결과"),
35
- gr.File(label="μƒμ„±λœ μ›Œν¬μ‹œνŠΈ")
36
- ],
37
- title="YouTube ν•™μŠ΅ μ›Œν¬μ‹œνŠΈ 생성기",
38
- description="YouTube μ˜μƒμ˜ μžλ§‰μ„ μ΄μš©ν•˜μ—¬ ν•™μŠ΅ μ›Œν¬μ‹œνŠΈλ₯Ό μƒμ„±ν•©λ‹ˆλ‹€."
39
- )
40
 
41
- if __name__ == "__main__":
42
- iface.launch()
 
 
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()