RamAnanth1 commited on
Commit
52d9e34
1 Parent(s): 381e026

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -3
app.py CHANGED
@@ -1,8 +1,14 @@
1
  import gradio as gr
 
2
 
3
- def greet(name):
4
- return "Hello " + name + "!!"
5
 
6
- demo = gr.Interface(fn=greet, inputs="text", outputs="text")
 
 
 
 
 
 
7
  demo.queue(max_size=10,concurrency_count=20)
8
  demo.launch(enable_queue=True)
 
1
  import gradio as gr
2
+ from transformers import pipeline
3
 
4
+ pipe = pipeline('text-generation', model='daspartho/prompt-extend')
 
5
 
6
+ def extend_prompt(input):
7
+ return pipe(prompt+',', num_return_sequences=1)[0]["generated_text"]
8
+
9
+ input_prompt = gr.Text(label="Enter the initial prompt")
10
+ sd2_output = gr.Text(label="Extended prompt suitable for Stable Diffusion 2")
11
+
12
+ demo = gr.Interface(fn=extend_prompt, inputs=input_prompt, outputs=sd2_output)
13
  demo.queue(max_size=10,concurrency_count=20)
14
  demo.launch(enable_queue=True)