Kentlo commited on
Commit
f1a8a5e
Β·
verified Β·
1 Parent(s): 87a9af8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +50 -0
app.py CHANGED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # app.py
2
+
3
+ import gradio as gr
4
+ import speech_recognition as sr
5
+ from transformers import pipeline
6
+ from datetime import datetime
7
+
8
+ # μš”μ•½κΈ° μ΄ˆκΈ°ν™”
9
+ summarizer = pipeline("summarization", model="t5-small")
10
+
11
+ # μŒμ„± νŒŒμΌμ„ λ°›μ•„ ν…μŠ€νŠΈ λ³€ν™˜ β†’ μš”μ•½ β†’ 회의둝 생성
12
+ def transcribe_and_summarize(audio):
13
+ recognizer = sr.Recognizer()
14
+ with sr.AudioFile(audio) as source:
15
+ audio_data = recognizer.record(source)
16
+ try:
17
+ text = recognizer.recognize_google(audio_data, language="ko-KR")
18
+ except:
19
+ return "μŒμ„± 인식 μ‹€νŒ¨", "", ""
20
+
21
+ summary = summarizer(text, max_length=100, min_length=30, do_sample=False)[0]['summary_text']
22
+
23
+ now = datetime.now().strftime("%Y-%m-%d %H:%M")
24
+ minutes = f"""
25
+ # 회의둝
26
+
27
+ - λ‚ μ§œ: {now}
28
+ - 회의 μš”μ•½:
29
+ {summary}
30
+
31
+ - 전체 λ‚΄μš©:
32
+ {text}
33
+ """
34
+ return text, summary, minutes
35
+
36
+ # Gradio UI ꡬ성
37
+ demo = gr.Interface(
38
+ fn=transcribe_and_summarize,
39
+ inputs=gr.Audio(source="microphone", type="filepath", label="πŸŽ™ 마이크둜 λ§ν•˜μ„Έμš”"),
40
+ outputs=[
41
+ gr.Textbox(label="πŸ“„ 전체 ν…μŠ€νŠΈ"),
42
+ gr.Textbox(label="🧠 μš”μ•½λ¬Έ"),
43
+ gr.Textbox(label="πŸ“‘ 회의둝 (볡사/μ €μž₯ κ°€λŠ₯)"),
44
+ ],
45
+ title="회의둝 μžλ™ 생성기",
46
+ description="λ§ν•˜λ©΄ ν…μŠ€νŠΈμ™€ μš”μ•½, νšŒμ˜λ‘μ„ μžλ™μœΌλ‘œ μƒμ„±ν•΄μ€λ‹ˆλ‹€. iPad/PC λͺ¨λ‘ μ‚¬μš© κ°€λŠ₯.",
47
+ )
48
+
49
+ if __name__ == "__main__":
50
+ demo.launch()