File size: 558 Bytes
76690a0 e4efcf3 7b211d6 c48fcb0 d05f479 c48fcb0 d05f479 42285be 7b211d6 7ea15cd e4efcf3 b973bfd aabda29 76690a0 7b211d6 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
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) |