Mrwrichard commited on
Commit
cf045f1
·
verified ·
1 Parent(s): f4d5507

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -5
app.py CHANGED
@@ -21,6 +21,7 @@ local_ip = requests.get('http://myip.ipip.net', timeout=5).text
21
  print('local_ip: ', local_ip)
22
 
23
  url = os.getenv('OMNITALKER_URL', "http://localhost:8012")
 
24
  headers = {"Content-Type": "application/json"}
25
 
26
  script_dir = Path(__file__).parent.absolute()
@@ -127,27 +128,29 @@ def check_http(url, timeout=5):
127
  print(f"Error: {e}")
128
  return False
129
 
130
- MAX_CONNECT_TIMES = 100000
131
  for try_loop in range(MAX_CONNECT_TIMES):
132
  print(f'Try: {try_loop}/{MAX_CONNECT_TIMES}')
133
  if check_http(url):
134
  break
135
- time.sleep(60)
136
 
137
  with open('style.css', 'r') as f:
138
  custom_css = f.read()
 
139
  with gr.Blocks(css=custom_css) as demo:
140
  gr.Markdown("# <center> OmniTalker </center>")
141
 
142
  gr.Markdown('''
143
  ### Steps:
144
  1. Select a character in Examples. Waiting for `Reference Video` to load the video.
145
- 2. Enter text and generate (Only Chinese and English are supported by far).
 
 
146
 
147
  ### Tips:
148
- 1. Try different `Seed` to achieve the best generation. God may not play dice, but AI does.
149
  2. Adjust `Speed` to control the speech rate. Especially when generating Chinese speech for native English speakers, recommended setting is 0.9~0.95.
150
- 3. Due to limitations in network speed and GPU resources, the generation speed may not achieve a real-time 1:1 ratio. Appreciate.
151
  ''')
152
 
153
  with gr.Group():
 
21
  print('local_ip: ', local_ip)
22
 
23
  url = os.getenv('OMNITALKER_URL', "http://localhost:8012")
24
+ max_length = os.getenv('OMNITALKER_MAX_LENGTH', 10)
25
  headers = {"Content-Type": "application/json"}
26
 
27
  script_dir = Path(__file__).parent.absolute()
 
128
  print(f"Error: {e}")
129
  return False
130
 
131
+ MAX_CONNECT_TIMES = 100
132
  for try_loop in range(MAX_CONNECT_TIMES):
133
  print(f'Try: {try_loop}/{MAX_CONNECT_TIMES}')
134
  if check_http(url):
135
  break
136
+ time.sleep(10)
137
 
138
  with open('style.css', 'r') as f:
139
  custom_css = f.read()
140
+
141
  with gr.Blocks(css=custom_css) as demo:
142
  gr.Markdown("# <center> OmniTalker </center>")
143
 
144
  gr.Markdown('''
145
  ### Steps:
146
  1. Select a character in Examples. Waiting for `Reference Video` to load the video.
147
+ 2. Enter text (Only **Chinese** and **English** are supported by far. Limit it to within **100** characters for performance.).
148
+ 3. Generate. (Due to limitations in network speed and GPU resources, the generation speed may not achieve a real-time 1:1 ratio. Appreciate.)
149
+
150
 
151
  ### Tips:
152
+ 1. Try different `Seed` to achieve the best generation(Use **-1** for automatic seeding). God may not play dice, but AI does.
153
  2. Adjust `Speed` to control the speech rate. Especially when generating Chinese speech for native English speakers, recommended setting is 0.9~0.95.
 
154
  ''')
155
 
156
  with gr.Group():