prakhardoneria commited on
Commit
31386f7
·
verified ·
1 Parent(s): abeaa28

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -8,8 +8,8 @@ from chromadb.config import Settings
8
  from transformers import pipeline
9
 
10
  # Device setup
11
- device = 0 if torch.cuda.is_available() else -1
12
- print(f"Device set to: {'cuda' if device == 0 else 'cpu'}")
13
 
14
  # Load CSV data
15
  df = pd.read_csv("iec_college_data.csv").dropna(subset=["content"]).reset_index(drop=True)
@@ -45,8 +45,8 @@ if collection.count() == 0:
45
  print(f"Indexed {idx}/{len(df)}")
46
  print("Indexing complete.")
47
 
48
- # QA model: Use a stronger model like Flan-T5-large if needed
49
- qa_pipeline = pipeline("text2text-generation", model="google/flan-t5-base", device=device)
50
 
51
  # QA function
52
  def answer_question(user_question):
 
8
  from transformers import pipeline
9
 
10
  # Device setup
11
+ device = -1 # Force CPU use
12
+ print("Device set to: CPU")
13
 
14
  # Load CSV data
15
  df = pd.read_csv("iec_college_data.csv").dropna(subset=["content"]).reset_index(drop=True)
 
45
  print(f"Indexed {idx}/{len(df)}")
46
  print("Indexing complete.")
47
 
48
+ # QA model: Use lighter model on CPU
49
+ qa_pipeline = pipeline("text2text-generation", model="google/flan-t5-small", device=device)
50
 
51
  # QA function
52
  def answer_question(user_question):