Spaces:
Sleeping
Sleeping
File size: 697 Bytes
1461250 8f476e4 1461250 a84e71a 258cf44 1461250 258cf44 1461250 a84e71a 258cf44 77d6dc7 258cf44 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | from transformers import TFT5ForConditionalGeneration, T5Tokenizer
import gradio as gr
model_name = "CeeJay00100/t5-edu-bot"
tokenizer = T5Tokenizer.from_pretrained(model_name)
model = TFT5ForConditionalGeneration.from_pretrained(model_name, from_pt=False)
def ask_bot(question):
input_text = "question: " + question
inputs = tokenizer(input_text, return_tensors="tf", padding=True)
outputs = model.generate(**inputs, max_length=100)
return tokenizer.decode(outputs[0], skip_special_tokens=True)
gr.Interface(
fn=ask_bot,
inputs="text",
outputs="text",
title="EdBot: Educational Chatbot",
description="Ask any math or general knowledge question!"
).launch() |