Spaces:
Runtime error
Runtime error
import gradio as gr | |
from transformers import pipeline | |
# Initialize the model pipeline | |
model_pipeline = pipeline("text-generation", model="lemon07r/Gemma-2-Ataraxy-9B") | |
# Define the prediction function | |
def generate_text(prompt): | |
result = model_pipeline(prompt, max_length=300) | |
return result[0]['generated_text'] | |
# Create the Gradio interface | |
gradio_app = gr.Interface( | |
fn=generate_text, | |
inputs=gr.Textbox(lines=5, placeholder="Enter your prompt here..."), | |
outputs="text", | |
title="Gemma-2-Ataraxy-9B Text Generator" | |
) | |
# Launch the app | |
if __name__ == "__main__": | |
gradio_app.launch() |