Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -8,8 +8,8 @@ from chromadb.config import Settings
|
|
| 8 |
from transformers import pipeline
|
| 9 |
|
| 10 |
# Device setup
|
| 11 |
-
device =
|
| 12 |
-
print(
|
| 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
|
| 49 |
-
qa_pipeline = pipeline("text2text-generation", model="google/flan-t5-
|
| 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):
|