Spaces:
Runtime error
Runtime error
Download app.py from dr-wasim/InfoDeskBot: direct link, hf CLI and curl.
- Browser
- Download file 664 Bytes
-
https://huggingface.co/spaces/dr-wasim/InfoDeskBot/resolve/main/app.py
- Command line
-
hf download hf://spaces/dr-wasim/InfoDeskBot/app.py
-
curl -L -o app.py https://huggingface.co/spaces/dr-wasim/InfoDeskBot/resolve/main/app.py
664 Bytes
| import gradio as gr | |
| import csv | |
| from transformers import pipeline | |
| responses = {} | |
| with open('Answers.csv', mode='r', encoding='utf-8-sig') as file: | |
| reader = csv.DictReader(file) | |
| for row in reader: | |
| intent = row['Intent'] | |
| answer = row['Answer'] | |
| responses[intent] = answer | |
| def respond(message, history): | |
| pipe = pipeline("text-classification", model="sehrishsafdar/urdu-intent-model") | |
| intent = pipe.predict(message) | |
| print(intent) | |
| return responses[intent[0]['label']] | |
| demo = gr.ChatInterface( | |
| respond, | |
| title="Urdu University Information Desk Chatbot", | |
| ) | |
| if __name__ == "__main__": | |
| demo.launch() | |