johngoad commited on
Commit
764a297
1 Parent(s): 4bb4b83

Upload app.py with huggingface_hub

Browse files
Files changed (1) hide show
  1. app.py +27 -0
app.py ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from transformers import pipeline
2
+ import gradio as gr
3
+
4
+ pipe = pipeline('text-generation', model='daspartho/prompt-extend')
5
+
6
+ def extend_prompt(prompt):
7
+ return pipe(prompt+',', num_return_sequences=1)[0]["generated_text"]
8
+
9
+ examples = [
10
+ ['elon musk as thor'],
11
+ ["giant dragon flying in the sky"],
12
+ ['psychedelic liquids space'],
13
+ ["a coconut laying on the beach"],
14
+ ["peaceful village landscape"],
15
+ ]
16
+
17
+ iface = gr.Interface(
18
+ description = "Enter a main idea for a prompt, and the model will attempt to add suitable style cues.",
19
+ article = "<p style='text-align: center'><a href='https://github.com/daspartho/prompt-extend' target='_blank'>Github</a></p>",
20
+ fn=extend_prompt,
21
+ inputs=gr.Text(label="Type the prompt here"),
22
+ outputs=gr.TextArea(label='Extended prompt'),
23
+ examples=examples,
24
+ title="Prompt Extend"
25
+ )
26
+
27
+ iface.launch()