Ofiroz91 commited on
Commit
0d7c116
โ€ข
1 Parent(s): ec2db99

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -2
app.py CHANGED
@@ -24,8 +24,9 @@ def transcribe_and_summarize(file_path):
24
  transcript = " ".join([segment.text for segment in segments])
25
 
26
  # ืกื™ื›ื•ื ื”ืชืžืœื•ืœ
27
- summary = summarizer(transcript, max_length=50, min_length=25, do_sample=False)[0]["summary_text"]
28
 
 
 
29
  # ืžื—ื™ืงืช ืงื•ื‘ืฅ ื”ืื•ื“ื™ื• ื‘ืžื™ื“ืช ื”ืฆื•ืจืš (ืื ื”ื™ื” ื•ื™ื“ืื•)
30
  if audio_file != file_path:
31
  os.remove(audio_file)
@@ -46,7 +47,10 @@ def convert_video_to_audio(video_file):
46
  interface = gr.Interface(
47
  fn=transcribe_and_summarize,
48
  inputs=gr.Audio(type="filepath"),
49
- outputs=["text", "text"], # ืคืœื˜ ื›ืคื•ืœ: ืชืžืœื•ืœ ื•ืกื™ื›ื•ื
 
 
 
50
  title="ืžืžื™ืจ ืื•ื“ื™ื•/ื•ื™ื“ืื• ืœืชืžืœื•ืœ ื•ืกื™ื›ื•ื",
51
  description="ื”ืขืœื” ืงื•ื‘ืฅ ืื•ื“ื™ื• ืื• ื•ื™ื“ืื• ืฉืœ ืžืจืฆื” ื•ืงื‘ืœ ืชืžืœื•ืœ ืžืœื ื•ืกื™ื›ื•ื ืงืฆืจ ืฉืœ ื”ืชื•ื›ืŸ."
52
  )
 
24
  transcript = " ".join([segment.text for segment in segments])
25
 
26
  # ืกื™ื›ื•ื ื”ืชืžืœื•ืœ
 
27
 
28
+ summary = summarizer(transcript, max_length=50, min_length=25, do_sample=False)[0]["summary_text"]
29
+ prompt_text = f"ืกื›ื ืืช ื”ืชืžืœื•ืœ ื”ื‘ื ื›ืฉื™ืขื•ืจ ืืงื“ืžื™ ื‘ืขื‘ืจื™ืช:\n{transcript}"
30
  # ืžื—ื™ืงืช ืงื•ื‘ืฅ ื”ืื•ื“ื™ื• ื‘ืžื™ื“ืช ื”ืฆื•ืจืš (ืื ื”ื™ื” ื•ื™ื“ืื•)
31
  if audio_file != file_path:
32
  os.remove(audio_file)
 
47
  interface = gr.Interface(
48
  fn=transcribe_and_summarize,
49
  inputs=gr.Audio(type="filepath"),
50
+ outputs=[
51
+ gr.outputs.Textbox(label="ืชืžืœื•ืœ"),
52
+ gr.outputs.Textbox(label="ืกื™ื›ื•ื")
53
+ ],
54
  title="ืžืžื™ืจ ืื•ื“ื™ื•/ื•ื™ื“ืื• ืœืชืžืœื•ืœ ื•ืกื™ื›ื•ื",
55
  description="ื”ืขืœื” ืงื•ื‘ืฅ ืื•ื“ื™ื• ืื• ื•ื™ื“ืื• ืฉืœ ืžืจืฆื” ื•ืงื‘ืœ ืชืžืœื•ืœ ืžืœื ื•ืกื™ื›ื•ื ืงืฆืจ ืฉืœ ื”ืชื•ื›ืŸ."
56
  )