mca183's picture
implement text generation with olmo
7b1c6ea
raw
history blame contribute delete
661 Bytes
import hf_olmo
from transformers import pipeline
import gradio as gr
olmo_pipe = pipeline("text-generation", model="allenai/OLMo-1B")
def generate(input):
output = olmo_pipe(input)
return output[0]["generated_text"]
demo = gr.Interface(fn=generate,
inputs=gr.Textbox(label="Prompt"),
outputs=gr.Textbox(label="Completion"),
title="Text Generation with OLMo-1B",
description="Generate any text using the `allenai/OLMo-1B` model under the hood!",
examples=["Large Language Model is", "The meaning of life is"]
)
demo.launch()