Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -239,9 +239,12 @@ class AdvancedRAG:
|
|
| 239 |
if hasattr(self, 'vector_store_id'):
|
| 240 |
self.vector_store_id = None
|
| 241 |
try:
|
| 242 |
-
#
|
| 243 |
-
|
| 244 |
-
|
|
|
|
|
|
|
|
|
|
| 245 |
tmp.flush()
|
| 246 |
with open(tmp.name, "rb") as file_obj:
|
| 247 |
file_obj = openai.files.create(
|
|
|
|
| 239 |
if hasattr(self, 'vector_store_id'):
|
| 240 |
self.vector_store_id = None
|
| 241 |
try:
|
| 242 |
+
# file is a bytes object, so assign a default name and extension
|
| 243 |
+
if not file:
|
| 244 |
+
raise Exception("No file uploaded.")
|
| 245 |
+
filename = 'uploaded_file.pdf' # Default extension, or infer from UI if needed
|
| 246 |
+
with tempfile.NamedTemporaryFile(delete=False, suffix=os.path.splitext(filename)[1]) as tmp:
|
| 247 |
+
tmp.write(file)
|
| 248 |
tmp.flush()
|
| 249 |
with open(tmp.name, "rb") as file_obj:
|
| 250 |
file_obj = openai.files.create(
|