Update app.py
Browse files
app.py
CHANGED
@@ -1,29 +1,12 @@
|
|
1 |
-
# -*- coding: utf-8 -*-
|
2 |
-
|
3 |
-
# Importing Dependancies
|
4 |
-
|
5 |
import gradio as gr
|
6 |
-
|
7 |
-
|
8 |
-
"
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
""
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
def func(context, question):
|
18 |
-
input = {
|
19 |
-
'question':question,
|
20 |
-
'context':context
|
21 |
-
}
|
22 |
-
res = nlu(input)
|
23 |
-
return res["answer", "score"]
|
24 |
-
|
25 |
-
descr = "This is a question and Answer Web app, you give it a context and ask it questions based on the context provided"
|
26 |
-
|
27 |
-
app = gr.Interface(fn=func, inputs=[gr.inputs.Textbox(lines=3, placeholder="put in your context here..."),"text"], outputs="text", score=score, title="Question Answer App", description=descr)
|
28 |
-
|
29 |
-
app.launch()
|
|
|
|
|
|
|
|
|
|
|
1 |
import gradio as gr
|
2 |
+
description = "Question Answering Demo 🙌🏼"
|
3 |
+
title = "Question Answering with Keras"
|
4 |
+
context = "Keras is an API designed for human beings, not machines. Keras follows best practices for reducing cognitive load: it offers consistent & simple APIs, it minimizes the number of user actions required for common use cases, and it provides clear & actionable error messages. It also has extensive documentation and developer guides. See the model here: hf.co/keras-io/transformers-qa"
|
5 |
+
question = "What is Keras?"
|
6 |
+
interface = gr.Interface.load("huggingface/deepset/xlm-roberta-large-squad2",
|
7 |
+
description=description,
|
8 |
+
title = title,
|
9 |
+
theme = "grass",
|
10 |
+
examples = [[context, question]]
|
11 |
+
)
|
12 |
+
interface.launch()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|