polymers / app.py
rish13's picture
Update app.py
b29446e verified
raw
history blame
599 Bytes
import gradio as gr
from transformers import pipeline
# Load the model
model = pipeline("text-generation", model="Rishitha0208/new-llm-for-advanced-materials")
def generate_text(prompt):
return model(prompt, max_length=50, num_return_sequences=1)[0]['generated_text']
# Define the Gradio interface
interface = gr.Interface(
fn=generate_text,
inputs=gr.Textbox(lines=2, placeholder="Enter your text here..."),
outputs="text",
title="Text Generation Model",
description="A text generation model using Hugging Face Transformers."
)
# Launch the interface
interface.launch()