kahennefer commited on
Commit
94d4a00
1 Parent(s): 053be7e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -22
app.py CHANGED
@@ -62,12 +62,7 @@ def summarize_abstract_from_pdf(pdf_file_path):
62
  return summarized_abstract2[0]['summary_text']
63
 
64
  def generate_audio_func(pdf_file):
65
- model_name = "suno/bark-small"
66
- # Download and load the specified model
67
- preload_models(model_name)
68
- # Access the input file path
69
- pdf_file_path = pdf_file.name
70
-
71
  # Generate audio from text
72
  #call the summarize abstract function
73
  text_prompt = summarize_abstract_from_pdf(pdf_file_path)
@@ -79,21 +74,6 @@ def generate_audio_func(pdf_file):
79
  write_wav(wav_file_path, 22050, (audio_array * 32767).astype(np.int16))
80
  return wav_file_path
81
 
82
-
83
- def generate_audio_func2(text):
84
-
85
- # Generate audio from text
86
- #call the summarize abstract function
87
- audio_array = generate_audio(text)
88
-
89
- # Create a temporary WAV file to save the audio
90
- with NamedTemporaryFile(suffix=".wav", delete=False) as temp_wav_file:
91
- wav_file_path = temp_wav_file.name
92
- write_wav(wav_file_path, 22050, (audio_array * 32767).astype(np.int16))
93
- return wav_file_path
94
-
95
-
96
-
97
 
98
 
99
  # Define app name, app description, and examples
@@ -105,7 +85,7 @@ input_component = gr.File(file_types=["pdf"])
105
  output_component = gr.Audio()
106
 
107
  demo = gr.Interface(
108
- fn=generate_audio_func2,
109
  inputs="text",
110
  outputs=output_component,
111
  title=app_name,
 
62
  return summarized_abstract2[0]['summary_text']
63
 
64
  def generate_audio_func(pdf_file):
65
+
 
 
 
 
 
66
  # Generate audio from text
67
  #call the summarize abstract function
68
  text_prompt = summarize_abstract_from_pdf(pdf_file_path)
 
74
  write_wav(wav_file_path, 22050, (audio_array * 32767).astype(np.int16))
75
  return wav_file_path
76
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
77
 
78
 
79
  # Define app name, app description, and examples
 
85
  output_component = gr.Audio()
86
 
87
  demo = gr.Interface(
88
+ fn=generate_audio_func,
89
  inputs="text",
90
  outputs=output_component,
91
  title=app_name,