Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -71,13 +71,13 @@ pipe = model(model_name)
|
|
71 |
|
72 |
def qa_result(context, question, file, pipe=pipe):
|
73 |
if file is not None:
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
if
|
80 |
-
text = "
|
81 |
else:
|
82 |
if extension == allowed_types[0]:
|
83 |
context = extract_text_from_pdf(file.name)
|
|
|
71 |
|
72 |
def qa_result(context, question, file, pipe=pipe):
|
73 |
if file is not None:
|
74 |
+
allowed_types = [".pdf", ".txt", ".docx"]
|
75 |
+
extension = "." + file.name.split(".")[-1].lower()
|
76 |
+
if not extension in allowed_types:
|
77 |
+
text = "Խնդրում եմ ներբեռնել .pdf, .txt, կամ .docx ֆայլեր"
|
78 |
+
else:
|
79 |
+
if len(question) == 0:
|
80 |
+
text = "Ես չեմ կարողանալ քեզ օգնել եթե ինձ չտաս հարցը"
|
81 |
else:
|
82 |
if extension == allowed_types[0]:
|
83 |
context = extract_text_from_pdf(file.name)
|