Spaces:
Running
Running
jhj0517
commited on
Commit
·
c062b15
1
Parent(s):
2952821
Refactor parameter
Browse files
modules/translation/deepl_api.py
CHANGED
|
@@ -126,6 +126,9 @@ class DeepLAPI:
|
|
| 126 |
String to return to gr.Textbox()
|
| 127 |
Files to return to gr.Files()
|
| 128 |
"""
|
|
|
|
|
|
|
|
|
|
| 129 |
self.cache_parameters(
|
| 130 |
api_key=auth_key,
|
| 131 |
is_pro=is_pro,
|
|
@@ -136,8 +139,8 @@ class DeepLAPI:
|
|
| 136 |
|
| 137 |
files_info = {}
|
| 138 |
for fileobj in fileobjs:
|
| 139 |
-
file_path = fileobj
|
| 140 |
-
file_name, file_ext = os.path.splitext(os.path.basename(fileobj
|
| 141 |
|
| 142 |
if file_ext == ".srt":
|
| 143 |
parsed_dicts = parse_srt(file_path=file_path)
|
|
|
|
| 126 |
String to return to gr.Textbox()
|
| 127 |
Files to return to gr.Files()
|
| 128 |
"""
|
| 129 |
+
if fileobjs and isinstance(fileobjs[0], gr.utils.NamedString):
|
| 130 |
+
fileobjs = [fileobj.name for fileobj in fileobjs]
|
| 131 |
+
|
| 132 |
self.cache_parameters(
|
| 133 |
api_key=auth_key,
|
| 134 |
is_pro=is_pro,
|
|
|
|
| 139 |
|
| 140 |
files_info = {}
|
| 141 |
for fileobj in fileobjs:
|
| 142 |
+
file_path = fileobj
|
| 143 |
+
file_name, file_ext = os.path.splitext(os.path.basename(fileobj))
|
| 144 |
|
| 145 |
if file_ext == ".srt":
|
| 146 |
parsed_dicts = parse_srt(file_path=file_path)
|