namberino
commited on
Commit
·
7b5875a
1
Parent(s):
9d3ce07
Fix file object has no attribute read
Browse files
app.py
CHANGED
@@ -92,7 +92,9 @@ def call_generate(file_obj, topics, n_questions, difficulty, question_type):
|
|
92 |
return {"error": "No file uploaded."}
|
93 |
|
94 |
# Read the uploaded file bytes and create multipart payload
|
95 |
-
file_bytes = file_obj
|
|
|
|
|
96 |
files = {"file": ("uploaded_file", file_bytes, "application/octet-stream")}
|
97 |
|
98 |
data = {
|
|
|
92 |
return {"error": "No file uploaded."}
|
93 |
|
94 |
# Read the uploaded file bytes and create multipart payload
|
95 |
+
file_bytes = read_file_input(file_obj)
|
96 |
+
if not file_bytes:
|
97 |
+
return {"error": "Could not read uploaded file (empty or unknown format)."}
|
98 |
files = {"file": ("uploaded_file", file_bytes, "application/octet-stream")}
|
99 |
|
100 |
data = {
|