Erebus / app.py
Manjushri's picture
Update app.py
e4efcf3
raw
history blame
558 Bytes
from transformers import AutoModelForCausalLM, AutoTokenizer
import modin.pandas as pd
import gradio as gr
tokenizer = AutoTokenizer.from_pretrained("KoboldAI/OPT-2.7B-Erebus")
model = AutoModelForCausalLM.from_pretrained("KoboldAI/OPT-2.7B-Erebus")
def chat(Prompt):
input_ids = tokenizer(Prompt, return_tensors="pt").input_ids
generated_ids = model.generate(input_ids, max_length=512)
bot = tokenizer.decode(generated_ids[0], skip_special_tokens=True)
return bot
gr.Interface(fn=chat, inputs='text', outputs='text').launch(debug=True)