app.py
CHANGED
|
@@ -14,6 +14,12 @@ than the risk
|
|
| 14 |
it took
|
| 15 |
to blossom.
|
| 16 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 17 |
word: """
|
| 18 |
|
| 19 |
examples = [["river"], ["night"], ["trees"],["table"],["laughs"]]
|
|
@@ -22,7 +28,7 @@ examples = [["river"], ["night"], ["trees"],["table"],["laughs"]]
|
|
| 22 |
def poem_generate(word):
|
| 23 |
|
| 24 |
p = prompt + word.lower() + "\n" + "poem using word: "
|
| 25 |
-
print(f"Prompt is :{p}")
|
| 26 |
json_ = {"inputs": p,
|
| 27 |
"parameters":
|
| 28 |
{
|
|
@@ -33,13 +39,13 @@ def poem_generate(word):
|
|
| 33 |
}}
|
| 34 |
response = requests.post(API_URL, json=json_)
|
| 35 |
output = response.json()
|
| 36 |
-
print(f"
|
| 37 |
poem = output[0]['generated_text'].split("\n\n")[0] # +"."
|
| 38 |
-
|
| 39 |
return poem
|
| 40 |
|
| 41 |
def poem_to_image(poem):
|
| 42 |
-
print(
|
| 43 |
poem = " ".join(poem.split('\n'))
|
| 44 |
poem = poem + " oil on canvas."
|
| 45 |
steps, width, height, images, diversity = '50','256','256','1',15
|
|
|
|
| 14 |
it took
|
| 15 |
to blossom.
|
| 16 |
|
| 17 |
+
word: bird
|
| 18 |
+
poem using word: She sights a bird, she chuckles
|
| 19 |
+
She flattens, then she crawls
|
| 20 |
+
She runs without the look of feet
|
| 21 |
+
Her eyes increase to Balls.
|
| 22 |
+
|
| 23 |
word: """
|
| 24 |
|
| 25 |
examples = [["river"], ["night"], ["trees"],["table"],["laughs"]]
|
|
|
|
| 28 |
def poem_generate(word):
|
| 29 |
|
| 30 |
p = prompt + word.lower() + "\n" + "poem using word: "
|
| 31 |
+
print(f"*****Inside poem_generate - Prompt is :{p}")
|
| 32 |
json_ = {"inputs": p,
|
| 33 |
"parameters":
|
| 34 |
{
|
|
|
|
| 39 |
}}
|
| 40 |
response = requests.post(API_URL, json=json_)
|
| 41 |
output = response.json()
|
| 42 |
+
print(f"GPTJ response without splits is: {output[0]['generated_text']}")
|
| 43 |
poem = output[0]['generated_text'].split("\n\n")[0] # +"."
|
| 44 |
+
print(f"Poem being returned is: {poem}")
|
| 45 |
return poem
|
| 46 |
|
| 47 |
def poem_to_image(poem):
|
| 48 |
+
print("*****Inside Poem_to_image")
|
| 49 |
poem = " ".join(poem.split('\n'))
|
| 50 |
poem = poem + " oil on canvas."
|
| 51 |
steps, width, height, images, diversity = '50','256','256','1',15
|