Download app.py from UISCSC535/example-image-classification: direct link, hf CLI and curl.
- Browser
- Download file 520 Bytes
-
https://huggingface.co/spaces/UISCSC535/example-image-classification/resolve/e55df3dc13d91b17ee492bce1a1275191cfecd6b/app.py
- Command line
-
hf download hf://spaces/UISCSC535/example-image-classification@e55df3dc13d91b17ee492bce1a1275191cfecd6b/app.py
-
curl -L -o app.py https://huggingface.co/spaces/UISCSC535/example-image-classification/resolve/e55df3dc13d91b17ee492bce1a1275191cfecd6b/app.py
520 Bytes
| from transformers import AutoModelForQuestionAnswering, AutoTokenizer, pipeline | |
| import gradio as grad | |
| import ast | |
| mdl_name = "deepset/roberta-base-squad2" | |
| my_pipeline = pipeline('question-answering', model=mdl_name, tokenizer=mdl_name) | |
| def answer_question(question,context): | |
| text= "{"+"'question': '"+question+"','context': '"+context+"'}" | |
| di=ast.literal_eval(text) | |
| response = my_pipeline(di) | |
| return response | |
| grad.Interface(answer_question, inputs=["text","text"], outputs="text").launch() |