Spaces:
Sleeping
Sleeping
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
from transformers import pipeline
|
3 |
+
|
4 |
+
try:
|
5 |
+
pipe = pipeline("text-generation", model="petertill/cordia-a6")
|
6 |
+
print("Model loaded successfully!")
|
7 |
+
|
8 |
+
def generate_text(prompt):
|
9 |
+
output = pipe(prompt, max_length=200)[0]['generated_text']
|
10 |
+
return output
|
11 |
+
|
12 |
+
iface = gr.Interface(
|
13 |
+
fn=generate_text,
|
14 |
+
inputs="text",
|
15 |
+
outputs="text",
|
16 |
+
title="Cordia-A6 Text Generation",
|
17 |
+
description="Generate text using the Cordia-A6 model."
|
18 |
+
)
|
19 |
+
|
20 |
+
iface.launch(server_name="0.0.0.0", server_port=7860)
|
21 |
+
|
22 |
+
except Exception as e:
|
23 |
+
print(f"Error: {e}")
|