Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -56,9 +56,9 @@ def context_func(message):
|
|
56 |
|
57 |
return most_similar_context
|
58 |
|
59 |
-
def answer_question(question):
|
60 |
context = context_func(question)
|
61 |
-
tokenizer = AutoTokenizer.from_pretrained("nlp-group/sindi-bert-final")
|
62 |
# Tokenize the inputs
|
63 |
inputs = tokenizer(question, context, return_tensors="pt", max_length=512, truncation=True)
|
64 |
|
@@ -88,7 +88,7 @@ def main():
|
|
88 |
"""
|
89 |
tokenizer = AutoTokenizer.from_pretrained("nlp-group/sindi-bert-final")
|
90 |
model = AutoModelForQuestionAnswering.from_pretrained("nlp-group/sindi-bert-final")
|
91 |
-
iface = gr.Interface(fn=answer_question,
|
92 |
inputs=["text"],
|
93 |
outputs=[gr.Textbox(label="Answer")],
|
94 |
title="Women Cancer ChatBot",
|
|
|
56 |
|
57 |
return most_similar_context
|
58 |
|
59 |
+
def answer_question(question, tokenizer, model):
|
60 |
context = context_func(question)
|
61 |
+
#tokenizer = AutoTokenizer.from_pretrained("nlp-group/sindi-bert-final")
|
62 |
# Tokenize the inputs
|
63 |
inputs = tokenizer(question, context, return_tensors="pt", max_length=512, truncation=True)
|
64 |
|
|
|
88 |
"""
|
89 |
tokenizer = AutoTokenizer.from_pretrained("nlp-group/sindi-bert-final")
|
90 |
model = AutoModelForQuestionAnswering.from_pretrained("nlp-group/sindi-bert-final")
|
91 |
+
iface = gr.Interface(fn=answer_question(tokenizer, model),
|
92 |
inputs=["text"],
|
93 |
outputs=[gr.Textbox(label="Answer")],
|
94 |
title="Women Cancer ChatBot",
|