tommy24 commited on
Commit
d4b7741
·
1 Parent(s): cf6433f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -0
app.py CHANGED
@@ -1,13 +1,17 @@
 
1
  import gradio as gr
2
  import requests
3
  import os
4
 
 
 
5
  def text_to_speech(text):
6
  test = os.environ.get("test")
7
  endpoint = f"https://api.voicerss.org/?key={test}&src={text}&hl=en-us&v=Mike"
8
  response = requests.get(endpoint)
9
  with open("output.mp3", "wb") as f:
10
  f.write(response.content)
 
11
  return "output.mp3"
12
 
13
  gr.Interface(text_to_speech, inputs="text", outputs="audio").launch()
 
1
+ from huggingface_space import Space
2
  import gradio as gr
3
  import requests
4
  import os
5
 
6
+ space = Space(api_key=os.environ.get("test2"))
7
+
8
  def text_to_speech(text):
9
  test = os.environ.get("test")
10
  endpoint = f"https://api.voicerss.org/?key={test}&src={text}&hl=en-us&v=Mike"
11
  response = requests.get(endpoint)
12
  with open("output.mp3", "wb") as f:
13
  f.write(response.content)
14
+ space.upload_file("output.mp3", f)
15
  return "output.mp3"
16
 
17
  gr.Interface(text_to_speech, inputs="text", outputs="audio").launch()