File size: 610 Bytes
27c47fb
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
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()