Spaces:
Runtime error
Runtime error
import gradio as gr | |
from transformers import pipeline | |
# Initialize the text generation pipeline | |
pipe = pipeline("text-generation", model="meta-llama/Meta-Llama-3.1-405B") | |
# Define the function to generate text | |
def generate_text(prompt): | |
result = pipe(prompt, max_length=50, num_return_sequences=1) | |
return result[0]['generated_text'] | |
# Create a Gradio interface | |
iface = gr.Interface( | |
fn=generate_text, | |
inputs=gr.inputs.Textbox(lines=2, placeholder="Enter your prompt here..."), | |
outputs="text", | |
title="Meta-Llama Text Generation", | |
description="Generate text using the Meta-Llama 3.1 405B model." | |
) | |
# Launch the interface | |
iface.launch() |