File size: 433 Bytes
cc330c7
66557b5
cc330c7
66557b5
cc330c7
66557b5
 
 
cc330c7
66557b5
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
import gradio as gr
from transformers import pipeline

qa = pipeline("text2text-generation", model="google/flan-t5-base")

def answer_question(prompt):
    output = qa(prompt, max_length=256, do_sample=False)
    return output[0]['generated_text']

gr.Interface(fn=answer_question, 
             inputs=gr.Textbox(label="Ask EduBot"),
             outputs=gr.Textbox(label="Answer"),
             title="Leo9 EduBot (CPU)").launch()