Spaces:
Running
Running
admin
commited on
Commit
·
35429ce
1
Parent(s):
3789f5e
sync ms
Browse files- app.py +2 -2
- modules/data.py +2 -2
- modules/exif.py +2 -2
- modules/gif.py +3 -3
- modules/github.py +2 -2
- modules/qr.py +2 -2
- modules/rct.py +2 -2
- modules/smtp.py +2 -2
- modules/tools.py +2 -2
- modules/trans.py +2 -2
- modules/url.py +2 -2
- utils.py +1 -1
app.py
CHANGED
@@ -9,7 +9,7 @@ from modules.smtp import smtp_tester
|
|
9 |
from modules.trans import translator
|
10 |
from modules.url import url_shortner
|
11 |
from modules.tools import webtools
|
12 |
-
from utils import
|
13 |
|
14 |
ZH2EN = {
|
15 |
"# 在线工具合集": "# Online Tools Collection",
|
@@ -27,7 +27,7 @@ ZH2EN = {
|
|
27 |
|
28 |
|
29 |
def _L(zh_txt: str):
|
30 |
-
return ZH2EN[zh_txt] if
|
31 |
|
32 |
|
33 |
if __name__ == "__main__":
|
|
|
9 |
from modules.trans import translator
|
10 |
from modules.url import url_shortner
|
11 |
from modules.tools import webtools
|
12 |
+
from utils import EN_US
|
13 |
|
14 |
ZH2EN = {
|
15 |
"# 在线工具合集": "# Online Tools Collection",
|
|
|
27 |
|
28 |
|
29 |
def _L(zh_txt: str):
|
30 |
+
return ZH2EN[zh_txt] if EN_US else zh_txt
|
31 |
|
32 |
|
33 |
if __name__ == "__main__":
|
modules/data.py
CHANGED
@@ -2,7 +2,7 @@ import csv
|
|
2 |
import json
|
3 |
import gradio as gr
|
4 |
import pandas as pd
|
5 |
-
from utils import clean_dir, TMP_DIR,
|
6 |
|
7 |
|
8 |
MODE = {"from": "jsonl", "to": "csv"}
|
@@ -20,7 +20,7 @@ ZH2EN = {
|
|
20 |
|
21 |
|
22 |
def _L(zh_txt: str):
|
23 |
-
return ZH2EN[zh_txt] if
|
24 |
|
25 |
|
26 |
def encoder_json(file_path: str):
|
|
|
2 |
import json
|
3 |
import gradio as gr
|
4 |
import pandas as pd
|
5 |
+
from utils import clean_dir, TMP_DIR, EN_US
|
6 |
|
7 |
|
8 |
MODE = {"from": "jsonl", "to": "csv"}
|
|
|
20 |
|
21 |
|
22 |
def _L(zh_txt: str):
|
23 |
+
return ZH2EN[zh_txt] if EN_US else zh_txt
|
24 |
|
25 |
|
26 |
def encoder_json(file_path: str):
|
modules/exif.py
CHANGED
@@ -5,7 +5,7 @@ import exifread
|
|
5 |
import gradio as gr
|
6 |
import pandas as pd
|
7 |
from PIL import Image
|
8 |
-
from utils import clean_dir, compress, mk_dir, unzip, TMP_DIR,
|
9 |
|
10 |
ZH2EN = {
|
11 |
"单图片处理": "Process single picture",
|
@@ -22,7 +22,7 @@ ZH2EN = {
|
|
22 |
|
23 |
|
24 |
def _L(zh_txt: str):
|
25 |
-
return ZH2EN[zh_txt] if
|
26 |
|
27 |
|
28 |
def get_exif(origin_file_path):
|
|
|
5 |
import gradio as gr
|
6 |
import pandas as pd
|
7 |
from PIL import Image
|
8 |
+
from utils import clean_dir, compress, mk_dir, unzip, TMP_DIR, EN_US
|
9 |
|
10 |
ZH2EN = {
|
11 |
"单图片处理": "Process single picture",
|
|
|
22 |
|
23 |
|
24 |
def _L(zh_txt: str):
|
25 |
+
return ZH2EN[zh_txt] if EN_US else zh_txt
|
26 |
|
27 |
|
28 |
def get_exif(origin_file_path):
|
modules/gif.py
CHANGED
@@ -3,7 +3,7 @@ import math
|
|
3 |
import gradio as gr
|
4 |
from PIL import Image, ImageSequence
|
5 |
from moviepy.editor import VideoFileClip
|
6 |
-
from utils import clean_dir, TMP_DIR,
|
7 |
|
8 |
ZH2EN = {
|
9 |
"上传视频 (请确保上传完整后再点击提交,若时长大于五秒可先在线裁剪)": "Upload video (please ensure the video is completely uploaded before clicking submit, you can crop it online to less than 5s)",
|
@@ -15,7 +15,7 @@ ZH2EN = {
|
|
15 |
|
16 |
|
17 |
def _L(zh_txt: str):
|
18 |
-
return ZH2EN[zh_txt] if
|
19 |
|
20 |
|
21 |
def get_frame_dur(gif: Image):
|
@@ -73,7 +73,7 @@ def infer(video_path: str, speed: float, target_w=640, cache=f"{TMP_DIR}/gif"):
|
|
73 |
def video2gif():
|
74 |
example = (
|
75 |
"https://www.modelscope.cn/studio/Genius-Society/online_tools/resolve/master"
|
76 |
-
if
|
77 |
else "."
|
78 |
)
|
79 |
return gr.Interface(
|
|
|
3 |
import gradio as gr
|
4 |
from PIL import Image, ImageSequence
|
5 |
from moviepy.editor import VideoFileClip
|
6 |
+
from utils import clean_dir, TMP_DIR, EN_US
|
7 |
|
8 |
ZH2EN = {
|
9 |
"上传视频 (请确保上传完整后再点击提交,若时长大于五秒可先在线裁剪)": "Upload video (please ensure the video is completely uploaded before clicking submit, you can crop it online to less than 5s)",
|
|
|
15 |
|
16 |
|
17 |
def _L(zh_txt: str):
|
18 |
+
return ZH2EN[zh_txt] if EN_US else zh_txt
|
19 |
|
20 |
|
21 |
def get_frame_dur(gif: Image):
|
|
|
73 |
def video2gif():
|
74 |
example = (
|
75 |
"https://www.modelscope.cn/studio/Genius-Society/online_tools/resolve/master"
|
76 |
+
if EN_US
|
77 |
else "."
|
78 |
)
|
79 |
return gr.Interface(
|
modules/github.py
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
import os
|
2 |
import requests
|
3 |
import gradio as gr
|
4 |
-
from utils import
|
5 |
|
6 |
ZH2EN = {
|
7 |
"仓库拥有者": "Repo owner",
|
@@ -19,7 +19,7 @@ ZH2EN = {
|
|
19 |
|
20 |
|
21 |
def _L(zh_txt: str):
|
22 |
-
return ZH2EN[zh_txt] if
|
23 |
|
24 |
|
25 |
def create_github_release(owner, repo, token, tag, name, description, files):
|
|
|
1 |
import os
|
2 |
import requests
|
3 |
import gradio as gr
|
4 |
+
from utils import EN_US
|
5 |
|
6 |
ZH2EN = {
|
7 |
"仓库拥有者": "Repo owner",
|
|
|
19 |
|
20 |
|
21 |
def _L(zh_txt: str):
|
22 |
+
return ZH2EN[zh_txt] if EN_US else zh_txt
|
23 |
|
24 |
|
25 |
def create_github_release(owner, repo, token, tag, name, description, files):
|
modules/qr.py
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
import gradio as gr
|
2 |
-
from utils import
|
3 |
|
4 |
ZH2EN = {
|
5 |
"二维码输出尺寸": "Image size",
|
@@ -11,7 +11,7 @@ ZH2EN = {
|
|
11 |
|
12 |
|
13 |
def _L(zh_txt: str):
|
14 |
-
return ZH2EN[zh_txt] if
|
15 |
|
16 |
|
17 |
def infer(img_size: int, input_txt: str):
|
|
|
1 |
import gradio as gr
|
2 |
+
from utils import EN_US
|
3 |
|
4 |
ZH2EN = {
|
5 |
"二维码输出尺寸": "Image size",
|
|
|
11 |
|
12 |
|
13 |
def _L(zh_txt: str):
|
14 |
+
return ZH2EN[zh_txt] if EN_US else zh_txt
|
15 |
|
16 |
|
17 |
def infer(img_size: int, input_txt: str):
|
modules/rct.py
CHANGED
@@ -2,7 +2,7 @@ import csv
|
|
2 |
import random
|
3 |
import pandas as pd
|
4 |
import gradio as gr
|
5 |
-
from utils import clean_dir, TMP_DIR,
|
6 |
|
7 |
ZH2EN = {
|
8 |
"输入参与者数量": "Number of participants",
|
@@ -14,7 +14,7 @@ ZH2EN = {
|
|
14 |
|
15 |
|
16 |
def _L(zh_txt: str):
|
17 |
-
return ZH2EN[zh_txt] if
|
18 |
|
19 |
|
20 |
def list_to_csv(list_of_dicts: list, filename: str):
|
|
|
2 |
import random
|
3 |
import pandas as pd
|
4 |
import gradio as gr
|
5 |
+
from utils import clean_dir, TMP_DIR, EN_US
|
6 |
|
7 |
ZH2EN = {
|
8 |
"输入参与者数量": "Number of participants",
|
|
|
14 |
|
15 |
|
16 |
def _L(zh_txt: str):
|
17 |
+
return ZH2EN[zh_txt] if EN_US else zh_txt
|
18 |
|
19 |
|
20 |
def list_to_csv(list_of_dicts: list, filename: str):
|
modules/smtp.py
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
import requests
|
2 |
import gradio as gr
|
3 |
-
from utils import API_SMTP,
|
4 |
|
5 |
ZH2EN = {
|
6 |
"收信人邮箱": "To email",
|
@@ -19,7 +19,7 @@ ZH2EN = {
|
|
19 |
|
20 |
|
21 |
def _L(zh_txt: str):
|
22 |
-
return ZH2EN[zh_txt] if
|
23 |
|
24 |
|
25 |
def infer(target, title, content, name, email, password, host, port):
|
|
|
1 |
import requests
|
2 |
import gradio as gr
|
3 |
+
from utils import API_SMTP, EN_US
|
4 |
|
5 |
ZH2EN = {
|
6 |
"收信人邮箱": "To email",
|
|
|
19 |
|
20 |
|
21 |
def _L(zh_txt: str):
|
22 |
+
return ZH2EN[zh_txt] if EN_US else zh_txt
|
23 |
|
24 |
|
25 |
def infer(target, title, content, name, email, password, host, port):
|
modules/tools.py
CHANGED
@@ -1,9 +1,9 @@
|
|
1 |
import gradio as gr
|
2 |
-
from utils import
|
3 |
|
4 |
|
5 |
def webtools():
|
6 |
-
domain = "static.hf.space" if
|
7 |
return gr.HTML(
|
8 |
f"<iframe src='https://genius-society-web-tools.{domain}' width='100%' style='aspect-ratio: 16 / 9;'></iframe>"
|
9 |
)
|
|
|
1 |
import gradio as gr
|
2 |
+
from utils import EN_US
|
3 |
|
4 |
|
5 |
def webtools():
|
6 |
+
domain = "static.hf.space" if EN_US else "ms.show"
|
7 |
return gr.HTML(
|
8 |
f"<iframe src='https://genius-society-web-tools.{domain}' width='100%' style='aspect-ratio: 16 / 9;'></iframe>"
|
9 |
)
|
modules/trans.py
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
import json
|
2 |
import requests
|
3 |
import gradio as gr
|
4 |
-
from utils import API_TRANS, KEY_TRANS,
|
5 |
|
6 |
ZH2EN = {
|
7 |
"输入文本区域": "Input text area",
|
@@ -13,7 +13,7 @@ ZH2EN = {
|
|
13 |
|
14 |
|
15 |
def _L(zh_txt: str):
|
16 |
-
return ZH2EN[zh_txt] if
|
17 |
|
18 |
|
19 |
def infer(source, direction):
|
|
|
1 |
import json
|
2 |
import requests
|
3 |
import gradio as gr
|
4 |
+
from utils import API_TRANS, KEY_TRANS, EN_US
|
5 |
|
6 |
ZH2EN = {
|
7 |
"输入文本区域": "Input text area",
|
|
|
13 |
|
14 |
|
15 |
def _L(zh_txt: str):
|
16 |
+
return ZH2EN[zh_txt] if EN_US else zh_txt
|
17 |
|
18 |
|
19 |
def infer(source, direction):
|
modules/url.py
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
import json
|
2 |
import requests
|
3 |
import gradio as gr
|
4 |
-
from utils import is_valid_url, HEADER,
|
5 |
|
6 |
ZH2EN = {
|
7 |
"输入长链接": "Input a long URL",
|
@@ -14,7 +14,7 @@ ZH2EN = {
|
|
14 |
|
15 |
|
16 |
def _L(zh_txt: str):
|
17 |
-
return ZH2EN[zh_txt] if
|
18 |
|
19 |
|
20 |
def noxlink(longUrl: str, domain="https://noxlink.net"):
|
|
|
1 |
import json
|
2 |
import requests
|
3 |
import gradio as gr
|
4 |
+
from utils import is_valid_url, HEADER, EN_US
|
5 |
|
6 |
ZH2EN = {
|
7 |
"输入长链接": "Input a long URL",
|
|
|
14 |
|
15 |
|
16 |
def _L(zh_txt: str):
|
17 |
+
return ZH2EN[zh_txt] if EN_US else zh_txt
|
18 |
|
19 |
|
20 |
def noxlink(longUrl: str, domain="https://noxlink.net"):
|
utils.py
CHANGED
@@ -3,7 +3,7 @@ import re
|
|
3 |
import shutil
|
4 |
import zipfile
|
5 |
|
6 |
-
|
7 |
API_SMTP = os.getenv("api_smtp")
|
8 |
API_TRANS = os.getenv("api_caiyun")
|
9 |
KEY_TRANS = os.getenv("apikey_caiyun")
|
|
|
3 |
import shutil
|
4 |
import zipfile
|
5 |
|
6 |
+
EN_US = os.getenv("LANG") != "zh_CN.UTF-8"
|
7 |
API_SMTP = os.getenv("api_smtp")
|
8 |
API_TRANS = os.getenv("api_caiyun")
|
9 |
KEY_TRANS = os.getenv("apikey_caiyun")
|