Spaces:
Sleeping
Sleeping
meirk-brd
commited on
Commit
·
39bf16d
1
Parent(s):
e4c640a
remove appended file
Browse files
tool.py
CHANGED
|
@@ -163,7 +163,6 @@ class BrightDataDatasetTool(Tool):
|
|
| 163 |
headers={
|
| 164 |
"Authorization": f"Bearer {api_token}",
|
| 165 |
"Content-Type": "application/json",
|
| 166 |
-
"Accept": "application/json",
|
| 167 |
},
|
| 168 |
timeout=60,
|
| 169 |
)
|
|
@@ -217,16 +216,6 @@ class BrightDataDatasetTool(Tool):
|
|
| 217 |
return self._ensure_scheme(raw)
|
| 218 |
|
| 219 |
if isinstance(raw, dict):
|
| 220 |
-
path_value = raw.get("path")
|
| 221 |
-
if isinstance(path_value, str) and os.path.isfile(path_value):
|
| 222 |
-
try:
|
| 223 |
-
with open(path_value, "r", encoding="utf-8", errors="ignore") as fh:
|
| 224 |
-
text = fh.read().strip()
|
| 225 |
-
if text:
|
| 226 |
-
return self._ensure_scheme(text)
|
| 227 |
-
except OSError:
|
| 228 |
-
pass
|
| 229 |
-
|
| 230 |
orig_name = raw.get("orig_name")
|
| 231 |
if (
|
| 232 |
isinstance(orig_name, str)
|
|
@@ -237,19 +226,9 @@ class BrightDataDatasetTool(Tool):
|
|
| 237 |
|
| 238 |
url_value = raw.get("url")
|
| 239 |
if isinstance(url_value, str):
|
| 240 |
-
if url_value.startswith("/gradio_api/file="):
|
| 241 |
-
file_path = url_value.split("=", 1)[-1]
|
| 242 |
-
if os.path.isfile(file_path):
|
| 243 |
-
try:
|
| 244 |
-
with open(file_path, "r", encoding="utf-8", errors="ignore") as fh:
|
| 245 |
-
text = fh.read().strip()
|
| 246 |
-
if text:
|
| 247 |
-
return self._ensure_scheme(text)
|
| 248 |
-
except OSError:
|
| 249 |
-
pass
|
| 250 |
-
return None
|
| 251 |
if url_value.startswith(("http://", "https://")):
|
| 252 |
return url_value
|
|
|
|
| 253 |
|
| 254 |
return None
|
| 255 |
|
|
|
|
| 163 |
headers={
|
| 164 |
"Authorization": f"Bearer {api_token}",
|
| 165 |
"Content-Type": "application/json",
|
|
|
|
| 166 |
},
|
| 167 |
timeout=60,
|
| 168 |
)
|
|
|
|
| 216 |
return self._ensure_scheme(raw)
|
| 217 |
|
| 218 |
if isinstance(raw, dict):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 219 |
orig_name = raw.get("orig_name")
|
| 220 |
if (
|
| 221 |
isinstance(orig_name, str)
|
|
|
|
| 226 |
|
| 227 |
url_value = raw.get("url")
|
| 228 |
if isinstance(url_value, str):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 229 |
if url_value.startswith(("http://", "https://")):
|
| 230 |
return url_value
|
| 231 |
+
return None
|
| 232 |
|
| 233 |
return None
|
| 234 |
|