Update app.py
Browse files
app.py
CHANGED
@@ -11,7 +11,7 @@ import traceback
|
|
11 |
# from save_cookie import save_cookie, get_cookie, cookie_f
|
12 |
# from scrap_util import getDriver, titleLocInfo, find_key_paragrap, extract_from_driver, table_record_doc
|
13 |
import helium as hm
|
14 |
-
from postDouyin import senDouyin
|
15 |
# 模型-------------
|
16 |
from transformers import *
|
17 |
|
@@ -307,27 +307,7 @@ def run_save_cookie(account_name):
|
|
307 |
save_cookie(driver, cookie_file_name)
|
308 |
gr.Dropdown.update(choices=account_fn, value=cookie_fns)
|
309 |
return "succ"
|
310 |
-
|
311 |
-
def mySendDouyin(cookie_fn, movie_file):
|
312 |
-
driver = getDriver()
|
313 |
-
# new_title = title.replace('\n', "").replace('”', "").replace('“', "").replace(' ', "")
|
314 |
-
# movie_file = f"{movie_dir}/{new_title}.mp4"
|
315 |
-
print(f"in mySendDouyin func: try send {movie_file}")
|
316 |
-
if not os.path.exists(movie_file):
|
317 |
-
raise f"movie_file not exists"
|
318 |
-
print(movie_file)
|
319 |
-
# senDouyin(account_name = cookie_fn, title = title, movie_path = movie_file, loc = "北京")
|
320 |
-
for i in range(5):
|
321 |
-
try:
|
322 |
-
senDouyin(driver = driver, account_name = cookie_fn, title = title, movie_path = movie_file, loc = "北京")
|
323 |
-
print(f"accunt {cookie_fn} 发布 {movie_file} succ")
|
324 |
-
break
|
325 |
-
except Exception as e:
|
326 |
-
traceback.print_exc()
|
327 |
-
driver.get_screenshot_as_file("1.png")
|
328 |
-
print("---mySendDouyin faild, continue try--")
|
329 |
-
continue
|
330 |
-
return "succ"
|
331 |
|
332 |
# 构建Blocks上下文 =======================================================================
|
333 |
with gr.Blocks() as demo:
|
@@ -414,14 +394,6 @@ with gr.Blocks() as demo:
|
|
414 |
mt_name_selected = gr.Dropdown(choices = templates_name, label = "选择模板进行生产")
|
415 |
# pre_img2 = gr.Image(label="生成结果预览", interactive=False)
|
416 |
|
417 |
-
with gr.TabItem("登录账号"):
|
418 |
-
with gr.Row():
|
419 |
-
login_ = gr.Button("登录抖音")
|
420 |
-
login_save = gr.Button("登录完成保存")
|
421 |
-
with gr.Row():
|
422 |
-
account_name_new = gr.Textbox(label="新建账号")
|
423 |
-
login_qr = gr.Image("qr.png", shape=(200, 200), label="登录账号")
|
424 |
-
# gr.Dropdown.update(choices=cookie_fns, value=cookie_fn)
|
425 |
with gr.TabItem("todo内嵌浏览器pyqt html"):
|
426 |
mp = gr.HTML(html, elem_id="coords", visible=True)
|
427 |
pass
|
|
|
11 |
# from save_cookie import save_cookie, get_cookie, cookie_f
|
12 |
# from scrap_util import getDriver, titleLocInfo, find_key_paragrap, extract_from_driver, table_record_doc
|
13 |
import helium as hm
|
14 |
+
# from postDouyin import senDouyin
|
15 |
# 模型-------------
|
16 |
from transformers import *
|
17 |
|
|
|
307 |
save_cookie(driver, cookie_file_name)
|
308 |
gr.Dropdown.update(choices=account_fn, value=cookie_fns)
|
309 |
return "succ"
|
310 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
311 |
|
312 |
# 构建Blocks上下文 =======================================================================
|
313 |
with gr.Blocks() as demo:
|
|
|
394 |
mt_name_selected = gr.Dropdown(choices = templates_name, label = "选择模板进行生产")
|
395 |
# pre_img2 = gr.Image(label="生成结果预览", interactive=False)
|
396 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
397 |
with gr.TabItem("todo内嵌浏览器pyqt html"):
|
398 |
mp = gr.HTML(html, elem_id="coords", visible=True)
|
399 |
pass
|