Spaces:
Runtime error
Runtime error
from transformers import AutoTokenizer, AutoModelForSequenceClassification | |
import torch | |
# Load IndicBERT Model | |
tokenizer = AutoTokenizer.from_pretrained("ai4bharat/indic-bert") | |
model = AutoModelForSequenceClassification.from_pretrained("ai4bharat/indic-bert") | |
def process_query(query): | |
inputs = tokenizer(query, return_tensors="pt") | |
with torch.no_grad(): | |
outputs = model(**inputs) | |
predicted_label = torch.argmax(outputs.logits).item() | |
# Basic intent handling (customize as needed) | |
if "appointment" in query.lower(): | |
return "I can help you book an appointment with a doctor." | |
elif "health" in query.lower(): | |
return "Can you describe your health concern?" | |
else: | |
return "Sorry, I didnβt understand. Can you please rephrase?" | |