Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -144,10 +144,15 @@ def answer_question(prompt):
|
|
144 |
|
145 |
|
146 |
def process_inputs(llm, file, relevance, diversity, email):
|
147 |
-
# Check if file is uploaded
|
148 |
if file is not None:
|
149 |
# Read questions from the uploaded file
|
150 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
151 |
questions_list = df.iloc[:, 0].tolist()
|
152 |
else:
|
153 |
return "No questions provided."
|
|
|
144 |
|
145 |
|
146 |
def process_inputs(llm, file, relevance, diversity, email):
|
|
|
147 |
if file is not None:
|
148 |
# Read questions from the uploaded file
|
149 |
+
try:
|
150 |
+
df = pd.read_csv(file.name, encoding='utf-8')
|
151 |
+
except UnicodeDecodeError:
|
152 |
+
try:
|
153 |
+
df = pd.read_csv(file.name, encoding='ISO-8859-1')
|
154 |
+
except Exception as e:
|
155 |
+
return f"Failed to read file: {e}"
|
156 |
questions_list = df.iloc[:, 0].tolist()
|
157 |
else:
|
158 |
return "No questions provided."
|