|
|
| import gradio as gr |
| from transformers import pipeline |
|
|
| |
| model_name = "sujra/insurance_Model" |
| qa_pipeline = pipeline("question-answering", model=model_name, tokenizer=model_name) |
|
|
| def get_answer(question): |
| answer = qa_pipeline(question=question, max_length=128, batch_size=4)['answer'] |
| return answer |
|
|
| |
| question_input = gr.inputs.Textbox(lines=2, label="Enter your question") |
| output_text = gr.outputs.Textbox(label="Answer") |
|
|
| |
| gr.Interface(fn=get_answer, inputs=question_input, outputs=output_text, title="Insurance Question Answering").launch() |
|
|