dron3flyv3r commited on
Commit
8d92114
·
1 Parent(s): 5d36b95

Refactor control function and update interface

Browse files
Files changed (1) hide show
  1. app.py +6 -4
app.py CHANGED
@@ -22,21 +22,23 @@ def summarize_text(text: str, bullet_points: int, conclusion: bool) -> str:
22
  summary = api.text_generation(prompt, max_new_tokens=250, do_sample=True)
23
  return summary["generated_text"]
24
 
25
- def control(audio_file: gr.AudioFile, text: str, bullet_points: int, conclusion: bool) -> str:
26
  if audio_file:
27
  text = transcript_audio(audio_file)
28
  summary = summarize_text(text, bullet_points, conclusion)
29
  return summary
30
  # make a simeple interface, where the user can input a text and get a summary or input an audio file and get a transcript and a summary
31
  iface = gr.Interface(
32
- fn=summarize_text,
33
  inputs=[
34
  gr.components.Audio(label="Audio file"),
35
  gr.components.Textbox(lines=5, label="Text"),
36
- gr.components.Slider(minimum=1, maximum=10, value=5, step=1, label="Number of bullet points"),
 
 
37
  gr.components.Checkbox(label="Add conclusion"),
38
  ],
39
- outputs=gr.components.Textbox(label="Summary")
40
  )
41
 
42
  iface.launch()
 
22
  summary = api.text_generation(prompt, max_new_tokens=250, do_sample=True)
23
  return summary["generated_text"]
24
 
25
+ def control(audio_file, text: str, bullet_points: int, conclusion: bool) -> str:
26
  if audio_file:
27
  text = transcript_audio(audio_file)
28
  summary = summarize_text(text, bullet_points, conclusion)
29
  return summary
30
  # make a simeple interface, where the user can input a text and get a summary or input an audio file and get a transcript and a summary
31
  iface = gr.Interface(
32
+ fn=control,
33
  inputs=[
34
  gr.components.Audio(label="Audio file"),
35
  gr.components.Textbox(lines=5, label="Text"),
36
+ gr.components.Slider(
37
+ minimum=1, maximum=10, value=5, step=1, label="Number of bullet points"
38
+ ),
39
  gr.components.Checkbox(label="Add conclusion"),
40
  ],
41
+ outputs=gr.components.Textbox(label="Summary"),
42
  )
43
 
44
  iface.launch()