Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -1,10 +1,6 @@
|
|
1 |
import gradio as gr
|
2 |
from transformers import pipeline
|
3 |
|
4 |
-
# Install required packages
|
5 |
-
import os
|
6 |
-
os.system("pip install -r requirements.txt")
|
7 |
-
|
8 |
# Load the pipeline for text generation
|
9 |
pipe = pipeline(
|
10 |
"text-generation",
|
@@ -16,18 +12,17 @@ pipe = pipeline(
|
|
16 |
def generate_text(prompt):
|
17 |
return pipe(prompt, max_length=77)[0]["generated_text"]
|
18 |
|
19 |
-
# Create a Gradio interface
|
20 |
iface = gr.Interface(
|
21 |
fn=generate_text,
|
22 |
inputs=gr.Textbox(lines=5, label="Prompt"),
|
23 |
outputs=gr.Textbox(label="Output", show_copy_button=True),
|
24 |
title="AI Art Prompt Generator",
|
25 |
description="Art Prompt Generator is a user-friendly interface designed to optimize input for AI Art Generator or Creator. For faster generation speeds, it's recommended to load the model locally with GPUs, as the online demo at Hugging Face Spaces utilizes CPU, resulting in slower processing times.",
|
26 |
-
api_name="predict"
|
|
|
|
|
27 |
)
|
28 |
|
29 |
-
# Integrate external CSS
|
30 |
-
iface.stylesheets.append("styles.css")
|
31 |
-
|
32 |
# Launch the interface
|
33 |
-
iface.launch(show_api=True)
|
|
|
1 |
import gradio as gr
|
2 |
from transformers import pipeline
|
3 |
|
|
|
|
|
|
|
|
|
4 |
# Load the pipeline for text generation
|
5 |
pipe = pipeline(
|
6 |
"text-generation",
|
|
|
12 |
def generate_text(prompt):
|
13 |
return pipe(prompt, max_length=77)[0]["generated_text"]
|
14 |
|
15 |
+
# Create a Gradio interface with custom theme
|
16 |
iface = gr.Interface(
|
17 |
fn=generate_text,
|
18 |
inputs=gr.Textbox(lines=5, label="Prompt"),
|
19 |
outputs=gr.Textbox(label="Output", show_copy_button=True),
|
20 |
title="AI Art Prompt Generator",
|
21 |
description="Art Prompt Generator is a user-friendly interface designed to optimize input for AI Art Generator or Creator. For faster generation speeds, it's recommended to load the model locally with GPUs, as the online demo at Hugging Face Spaces utilizes CPU, resulting in slower processing times.",
|
22 |
+
api_name="predict",
|
23 |
+
theme="huggingface",
|
24 |
+
css="theme.css" # Specify the path to your custom theme CSS file
|
25 |
)
|
26 |
|
|
|
|
|
|
|
27 |
# Launch the interface
|
28 |
+
iface.launch(show_api=True)
|