Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
|
2 |
from transformers import AutoModelWithLMHead, AutoTokenizer
|
3 |
|
4 |
tokenizer = AutoTokenizer.from_pretrained("mrm8488/t5-base-finetuned-question-generation-ap")
|
@@ -14,9 +14,10 @@ def get_question(context, answer, max_length=64):
|
|
14 |
|
15 |
return tokenizer.decode(output[0])[16:-4]
|
16 |
|
17 |
-
examples = [["
|
18 |
|
19 |
css = """
|
|
|
20 |
.output-markdown{display:none !important}
|
21 |
.gr-button-primary {
|
22 |
z-index: 14;
|
@@ -63,5 +64,5 @@ css = """
|
|
63 |
background-color: rgb(229,225,255) !important;
|
64 |
}
|
65 |
"""
|
66 |
-
demo = gr.Interface(fn=get_question, inputs=[gr.Textbox(lines=3, placeholder="Enter text here", label="Input # 1 - Context"), gr.Textbox(lines=1, label="Input # 2 - Answer")], outputs=gr.Textbox(label="Output - Generated Question"), title="Question Generator", examples=examples, css=css)
|
67 |
demo.launch()
|
|
|
1 |
+
mport gradio as gr
|
2 |
from transformers import AutoModelWithLMHead, AutoTokenizer
|
3 |
|
4 |
tokenizer = AutoTokenizer.from_pretrained("mrm8488/t5-base-finetuned-question-generation-ap")
|
|
|
14 |
|
15 |
return tokenizer.decode(output[0])[16:-4]
|
16 |
|
17 |
+
examples = [["The world's first piece of software was written by a computer scientist named Tom Kilburn in 1948.", "1948"], ["The world's first piece of software was written by a computer scientist named Tom Kilburn in 1948.", "Tom Kilburn"], ["The world's first piece of software was written by a computer scientist named Tom Kilburn in 1948.", "computer scientist"]]
|
18 |
|
19 |
css = """
|
20 |
+
footer {display:none !important}
|
21 |
.output-markdown{display:none !important}
|
22 |
.gr-button-primary {
|
23 |
z-index: 14;
|
|
|
64 |
background-color: rgb(229,225,255) !important;
|
65 |
}
|
66 |
"""
|
67 |
+
demo = gr.Interface(fn=get_question, inputs=[gr.Textbox(lines=3, placeholder="Enter text here", label="Input # 1 - Context"), gr.Textbox(lines=1, label="Input # 2 - Answer")], outputs=gr.Textbox(label="Output - Generated Question"), title="Question Generator | Data Science Dojo", examples=examples, css=css)
|
68 |
demo.launch()
|