|
import gradio |
|
from transformers import pipeline |
|
|
|
|
|
model = pipeline(model='google/flan-t5-large') |
|
|
|
|
|
|
|
def chatbot(input_text): |
|
|
|
prompt = f"Give the answer of the given input in context from the bhagwat geeta. give suggestions to user which are based upon the meanings of shlok in bhagwat geeta, input = {input_text}" |
|
|
|
response = model(prompt, max_length=250, do_sample=True)[0]['generated_text'].strip() |
|
|
|
|
|
return response |
|
|
|
|
|
gradio_interface = gradio.Interface( |
|
fn=chatbot, |
|
inputs='text', |
|
outputs='text', |
|
title='Chatbot', |
|
description='A weird chatbot conversations experience.', |
|
examples=[ |
|
['Hi, how are you?'] |
|
] |
|
) |
|
|
|
|
|
gradio_interface.launch() |