Spaces:
Runtime error
Runtime error
requirements.txt
Browse filesgradio
transformers
torch
app.py
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
from transformers import pipeline
|
3 |
+
|
4 |
+
# Initialize the model pipeline
|
5 |
+
model_pipeline = pipeline("text-generation", model="lemon07r/Gemma-2-Ataraxy-9B")
|
6 |
+
|
7 |
+
# Define the prediction function
|
8 |
+
def generate_text(prompt):
|
9 |
+
result = model_pipeline(prompt, max_length=300)
|
10 |
+
return result[0]['generated_text']
|
11 |
+
|
12 |
+
# Create the Gradio interface
|
13 |
+
gradio_app = gr.Interface(
|
14 |
+
fn=generate_text,
|
15 |
+
inputs=gr.Textbox(lines=5, placeholder="Enter your prompt here..."),
|
16 |
+
outputs="text",
|
17 |
+
title="Gemma-2-Ataraxy-9B Text Generator"
|
18 |
+
)
|
19 |
+
|
20 |
+
# Launch the app
|
21 |
+
if __name__ == "__main__":
|
22 |
+
gradio_app.launch()
|