chatbot / app.py
iamkhadke's picture
Update app.py
5638141
raw
history blame
616 Bytes
from transformers import AutoModelForCausalLM, AutoTokenizer
from instruct_pipeline import InstructionTextGenerationPipeline
import torch
tokenizer = AutoTokenizer.from_pretrained("databricks/dolly-v2-3b", padding_side="left")
model = AutoModelForCausalLM.from_pretrained("databricks/dolly-v2-3b", torch_dtype=torch.bfloat16)
generate_text = InstructionTextGenerationPipeline(model=model, tokenizer=tokenizer)
import gradio as gr
def greet(question):
return generate_text(question)
iface = gr.Interface(fn=greet, inputs="text", outputs="text")
iface.launch()