CuddleBuddys commited on
Commit
757c02c
1 Parent(s): 7b25572

Update openvoice_app.py

Browse files
Files changed (1) hide show
  1. openvoice_app.py +6 -6
openvoice_app.py CHANGED
@@ -97,7 +97,7 @@ database = result.path[1:]
97
  sslmode = parse_qs(result.query)['sslmode'][0]
98
 
99
  # Function to add user information to the database
100
- def add_user_info_to_db(email, order, sample_audio, name):
101
  connection = psycopg2.connect(
102
  dbname=database,
103
  user=user,
@@ -109,11 +109,11 @@ def add_user_info_to_db(email, order, sample_audio, name):
109
  cursor = connection.cursor()
110
 
111
  insert_query = """
112
- INSERT INTO example_table (email, order, sample_audio, name)
113
  VALUES (%s, %s, %s, %s);
114
  """
115
  try:
116
- cursor.execute(insert_query, (email, order, sample_audio, name))
117
  connection.commit()
118
  print("User information added to the database successfully")
119
  except Exception as error:
@@ -124,7 +124,7 @@ def add_user_info_to_db(email, order, sample_audio, name):
124
  connection.close()
125
 
126
  # Predict function
127
- def predict(prompt, style, audio_file_pth, voice_name, customer_email, order):
128
  text_hint = 'Your file will only be saved for 24 hours.\n'
129
  if len(prompt) < 2:
130
  text_hint += "[ERROR] Please provide a longer prompt text.\n"
@@ -156,7 +156,7 @@ def predict(prompt, style, audio_file_pth, voice_name, customer_email, order):
156
  # Add user information to the database
157
  with open(audio_file_pth, "rb") as f:
158
  sample_audio = f.read()
159
- add_user_info_to_db(customer_email, order, sample_audio, voice_name)
160
 
161
  return text_hint, save_path, audio_file_pth
162
 
@@ -203,7 +203,7 @@ with gr.Blocks(gr.themes.Glass()) as demo:
203
  tts_button.click(predict, [input_text_gr, style_gr, ref_gr, voice_name_gr, customer_email_gr, order_gr], outputs=[out_text_gr, audio_gr, ref_audio_gr])
204
 
205
  demo.queue()
206
- demo.launch(debug=True, show_api=False, share=args.share)
207
 
208
  css = """
209
  footer {visibility: hidden}
 
97
  sslmode = parse_qs(result.query)['sslmode'][0]
98
 
99
  # Function to add user information to the database
100
+ def add_user_info_to_db(email, order_name, sample_audio, name):
101
  connection = psycopg2.connect(
102
  dbname=database,
103
  user=user,
 
109
  cursor = connection.cursor()
110
 
111
  insert_query = """
112
+ INSERT INTO example_table (email, order_name, sample_audio, name)
113
  VALUES (%s, %s, %s, %s);
114
  """
115
  try:
116
+ cursor.execute(insert_query, (email, order_name, sample_audio, name))
117
  connection.commit()
118
  print("User information added to the database successfully")
119
  except Exception as error:
 
124
  connection.close()
125
 
126
  # Predict function
127
+ def predict(prompt, style, audio_file_pth, voice_name, customer_email, order_name):
128
  text_hint = 'Your file will only be saved for 24 hours.\n'
129
  if len(prompt) < 2:
130
  text_hint += "[ERROR] Please provide a longer prompt text.\n"
 
156
  # Add user information to the database
157
  with open(audio_file_pth, "rb") as f:
158
  sample_audio = f.read()
159
+ add_user_info_to_db(customer_email, order_name, sample_audio, voice_name)
160
 
161
  return text_hint, save_path, audio_file_pth
162
 
 
203
  tts_button.click(predict, [input_text_gr, style_gr, ref_gr, voice_name_gr, customer_email_gr, order_gr], outputs=[out_text_gr, audio_gr, ref_audio_gr])
204
 
205
  demo.queue()
206
+ demo.launch(debug=True, show_api=False, share=True)
207
 
208
  css = """
209
  footer {visibility: hidden}