update
Browse files
app.py
CHANGED
@@ -4,6 +4,7 @@ import requests
|
|
4 |
# GPT-J-6B API
|
5 |
API_URL = "https://api-inference.huggingface.co/models/EleutherAI/gpt-j-6B"
|
6 |
|
|
|
7 |
|
8 |
|
9 |
def poem_generate(word):
|
@@ -20,7 +21,7 @@ def poem_generate(word):
|
|
20 |
|
21 |
word: """
|
22 |
|
23 |
-
prompt = prompt + word + "\n" + "poem using word: "
|
24 |
json_ = {"inputs": prompt,
|
25 |
"parameters":
|
26 |
{
|
@@ -45,6 +46,11 @@ def poem_to_image(poem):
|
|
45 |
demo = gr.Blocks()
|
46 |
|
47 |
with demo:
|
|
|
|
|
|
|
|
|
|
|
48 |
input_word = gr.Textbox(placeholder="Enter a word here to create a Poem on..")
|
49 |
poem_txt = gr.Textbox(lines=7)
|
50 |
output_image = gr.Image(type="filepath", shape=(256,256))
|
|
|
4 |
# GPT-J-6B API
|
5 |
API_URL = "https://api-inference.huggingface.co/models/EleutherAI/gpt-j-6B"
|
6 |
|
7 |
+
examples = [["the roads are lovely dark and deep"], ["to be or not to be is the question, isn't it"], ["Elon Musk is not sure about "]]
|
8 |
|
9 |
|
10 |
def poem_generate(word):
|
|
|
21 |
|
22 |
word: """
|
23 |
|
24 |
+
prompt = prompt + word.lower() + "\n" + "poem using word: "
|
25 |
json_ = {"inputs": prompt,
|
26 |
"parameters":
|
27 |
{
|
|
|
46 |
demo = gr.Blocks()
|
47 |
|
48 |
with demo:
|
49 |
+
gr.Markdown("<h1><center>Generate Short Poem along with an Illustration</center></h1>")
|
50 |
+
gr.Markdown(
|
51 |
+
"<div>Enter a single word you would want GPTJ-6B to write poetry on.</div>"
|
52 |
+
"<div>Generate an illustration provided by Latent Diffusion model.</div><div>GPJ-6B is a 6 Billion parameter autoregressive language model. It generates the Poem based on how it has been 'prompt-engineered' 🤗 The complete text of generated poem then goes in as a prompt to the amazing Latent Diffusion Art space by <a href='https://huggingface.co/spaces/multimodalart/latentdiffusion' target='_blank'>Multimodalart</a>.</div>"
|
53 |
+
)
|
54 |
input_word = gr.Textbox(placeholder="Enter a word here to create a Poem on..")
|
55 |
poem_txt = gr.Textbox(lines=7)
|
56 |
output_image = gr.Image(type="filepath", shape=(256,256))
|