Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -127,7 +127,7 @@ def embed_pdf(file, filename, collection_name, file_type):
|
|
127 |
context = ssl._create_unverified_context()
|
128 |
with urllib.request.urlopen(file, context=context) as response, open(filename, 'wb') as out_file:
|
129 |
data = response.read()
|
130 |
-
out_file.write(
|
131 |
file_path = filename
|
132 |
except Exception as e:
|
133 |
return {"error": f"Error downloading file from URL: {e}"}
|
@@ -139,7 +139,7 @@ def embed_pdf(file, filename, collection_name, file_type):
|
|
139 |
file_content = file
|
140 |
file_path = os.path.join('./', filename)
|
141 |
with open(file_path, 'wb') as f:
|
142 |
-
f.write(
|
143 |
else:
|
144 |
return {"error": "Invalid file type"}
|
145 |
|
|
|
127 |
context = ssl._create_unverified_context()
|
128 |
with urllib.request.urlopen(file, context=context) as response, open(filename, 'wb') as out_file:
|
129 |
data = response.read()
|
130 |
+
out_file.write(data_bytes)
|
131 |
file_path = filename
|
132 |
except Exception as e:
|
133 |
return {"error": f"Error downloading file from URL: {e}"}
|
|
|
139 |
file_content = file
|
140 |
file_path = os.path.join('./', filename)
|
141 |
with open(file_path, 'wb') as f:
|
142 |
+
f.write(file_bytes)
|
143 |
else:
|
144 |
return {"error": "Invalid file type"}
|
145 |
|