Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -15,6 +15,7 @@ import random
|
|
15 |
from PIL import Image
|
16 |
import gradio as gr
|
17 |
openai.api_key ='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'
|
|
|
18 |
|
19 |
# def split_article(article_text):
|
20 |
# words = article_text.split()
|
@@ -393,21 +394,25 @@ openai.api_key ='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'
|
|
393 |
# "Imagine a colossal arena where AI-powered chatbots engage in an epic battle for dominance. The arena is a futuristic coliseum with digital screens lining the walls, broadcasting the ongoing clashes between chatbot warriors. Each chatbot represents a different AI assistant, armed with unique capabilities and strategies. The crowd roars with anticipation as they place their bets on which chatbot will emerge victorious. Describe the electrifying atmosphere of competition and the spectacle of Chatbot Wars.",
|
394 |
# "Picture a digital revolution square, where AI chatbots lead the charge for a new era of digital communication. The square is a vibrant hub of innovation, with holographic screens displaying the transformation of messaging through AI. AI chatbot leaders, with visionary personas, address the gathered crowd, sharing their insights and predictions for the future of digital communication. Describe the electric atmosphere of change and the role AI chatbots play in reshaping the digital landscape."])
|
395 |
|
|
|
|
|
396 |
def get_image(prompt):
|
397 |
-
api_token="r8_DwF25VNEJXEdjULfkV5gBjYnnJ6pwlg4OmDg7"
|
398 |
client = replicate.Client(api_token=api_token)
|
399 |
output = client.run(
|
400 |
"stability-ai/sdxl:a00d0b7dcbb9c3fbb34ba87d2d5b46c56969c84a628bf778a7fdaec30b1b99c5",
|
401 |
-
input={
|
402 |
-
|
403 |
-
|
404 |
-
|
|
|
|
|
405 |
)
|
406 |
gambar = output
|
407 |
image_url = gambar[0]
|
408 |
response = requests.get(image_url)
|
409 |
-
|
410 |
-
|
411 |
|
412 |
# return tags, content, url #image, image_data
|
413 |
|
|
|
15 |
from PIL import Image
|
16 |
import gradio as gr
|
17 |
openai.api_key ='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'
|
18 |
+
from io import BytesIO
|
19 |
|
20 |
# def split_article(article_text):
|
21 |
# words = article_text.split()
|
|
|
394 |
# "Imagine a colossal arena where AI-powered chatbots engage in an epic battle for dominance. The arena is a futuristic coliseum with digital screens lining the walls, broadcasting the ongoing clashes between chatbot warriors. Each chatbot represents a different AI assistant, armed with unique capabilities and strategies. The crowd roars with anticipation as they place their bets on which chatbot will emerge victorious. Describe the electrifying atmosphere of competition and the spectacle of Chatbot Wars.",
|
395 |
# "Picture a digital revolution square, where AI chatbots lead the charge for a new era of digital communication. The square is a vibrant hub of innovation, with holographic screens displaying the transformation of messaging through AI. AI chatbot leaders, with visionary personas, address the gathered crowd, sharing their insights and predictions for the future of digital communication. Describe the electric atmosphere of change and the role AI chatbots play in reshaping the digital landscape."])
|
396 |
|
397 |
+
|
398 |
+
|
399 |
def get_image(prompt):
|
400 |
+
api_token = "r8_DwF25VNEJXEdjULfkV5gBjYnnJ6pwlg4OmDg7"
|
401 |
client = replicate.Client(api_token=api_token)
|
402 |
output = client.run(
|
403 |
"stability-ai/sdxl:a00d0b7dcbb9c3fbb34ba87d2d5b46c56969c84a628bf778a7fdaec30b1b99c5",
|
404 |
+
input={
|
405 |
+
"prompt": 'Phantasmal iridescent, vibrant color, high contrast, award winning, trending in artstation, digital art,' + prompt.strip(),
|
406 |
+
"negative_prompt": 'NSFW, cityscape',
|
407 |
+
"width": 1648,
|
408 |
+
"height": 1024
|
409 |
+
}
|
410 |
)
|
411 |
gambar = output
|
412 |
image_url = gambar[0]
|
413 |
response = requests.get(image_url)
|
414 |
+
img = Image.open(BytesIO(response.content))
|
415 |
+
return img
|
416 |
|
417 |
# return tags, content, url #image, image_data
|
418 |
|