Spaces:
Sleeping
Sleeping
File size: 411 Bytes
51c3e2c |
1 2 3 4 5 6 7 8 9 10 11 12 13 |
from typing import Optional
def get_response_from_huggingface_dataset(message: str, DATASET) -> Optional[str]:
for data in DATASET["train"]:
if "dialog" in data and len(data["dialog"]) > 1:
input_text: str = data["dialog"][0].lower()
response_text: str = data["dialog"][1]
if input_text == message.lower():
return response_text
return None
|