Sayandip commited on
Commit
fdb7f3e
·
verified ·
1 Parent(s): bb234b1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -46,7 +46,7 @@ def load_and_extract_text(file_path):
46
  reader = csv.reader(f)
47
  return '\n'.join(' '.join(row) for row in reader)
48
 
49
- elif ext == 'txt':
50
  with open(file_path, 'r', encoding='utf-8') as f:
51
  return f.read()
52
 
@@ -61,7 +61,7 @@ def load_and_extract_text(file_path):
61
  return f"Error processing file: {e}"
62
 
63
  # File uploader
64
- uploaded_file = st.file_uploader("Upload a document or image", type=["docx", "xlsx", "pdf", "csv", "txt", "pptx", "jpg", "jpeg", "png"])
65
 
66
  # Question input
67
  question = st.text_input("💬 Enter your question:")
 
46
  reader = csv.reader(f)
47
  return '\n'.join(' '.join(row) for row in reader)
48
 
49
+ elif ext == 'txt' or ext == 'py': # ✅ Added .py support here
50
  with open(file_path, 'r', encoding='utf-8') as f:
51
  return f.read()
52
 
 
61
  return f"Error processing file: {e}"
62
 
63
  # File uploader
64
+ uploaded_file = st.file_uploader("Upload a document or image", type=["docx", "xlsx", "pdf", "csv", "txt", "pptx", "jpg", "jpeg", "png", "py"]) # ✅ Include .py here
65
 
66
  # Question input
67
  question = st.text_input("💬 Enter your question:")