Spaces:
Build error
Build error
File size: 411 Bytes
3b4b1fb |
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
|