Spaces:
Running
Running
prithivMLmods
commited on
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from transformers import pipeline
|
2 |
+
import gradio as gr
|
3 |
+
|
4 |
+
pipe = pipeline('text-generation', model='prithivMLmods/Stark-Prompt-Extender')
|
5 |
+
|
6 |
+
def extend_prompt(prompt):
|
7 |
+
return pipe(prompt+',', num_return_sequences=1)[0]["generated_text"]
|
8 |
+
|
9 |
+
examples = [
|
10 |
+
["a carnival of robots in a neon cityscape"],
|
11 |
+
["a mermaid playing electric guitar underwater"],
|
12 |
+
["a swarm of fireflies illuminating a moonlit forest"],
|
13 |
+
["a time-traveling pirate ship sailing through a storm of stars"],
|
14 |
+
["a mystical portal hidden in a waterfall"],
|
15 |
+
]
|
16 |
+
|
17 |
+
|
18 |
+
iface = gr.Interface(
|
19 |
+
description = "Enter a main idea for a prompt, and the model will attempt to add suitable style cues.",
|
20 |
+
article = "<p style='text-align: center'><a href='https://github.com/PRITHIVSAKTHIUR/Prompt-Extender-Gpt' target='_blank'> 🫙</a></p>",
|
21 |
+
fn=extend_prompt,
|
22 |
+
inputs=gr.Text(label="Type the prompt here"),
|
23 |
+
outputs=gr.TextArea(label='Extended prompt'),
|
24 |
+
examples=examples,
|
25 |
+
title="Prompt Extender"
|
26 |
+
)
|
27 |
+
|
28 |
+
iface.launch(enable_queue=False)
|