|
import gradio as gr |
|
from transformers import pipeline |
|
|
|
|
|
pipe = pipeline("text-generation", model="oMarquess/trained-2k10-v4-model-merged", trust_remote_code=True) |
|
|
|
|
|
def generate_text(input_text): |
|
generated_text = pipe(input_text, max_length=50, num_return_sequences=1)[0]['generated_text'] |
|
return generated_text |
|
|
|
|
|
iface = gr.Interface( |
|
fn=generate_text, |
|
inputs=gr.Textbox(label="Input Text"), |
|
outputs=gr.Textbox(label="Generated Text"), |
|
layout="vertical", |
|
title="Text Generation App", |
|
description="Generate text using a pretrained model.", |
|
) |
|
|
|
|
|
if __name__ == "__main__": |
|
iface.launch() |
|
|