Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -394,26 +394,18 @@ openai.api_key ='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'
|
|
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 |
-
|
398 |
-
|
399 |
-
|
400 |
-
|
401 |
-
|
402 |
-
|
403 |
-
|
404 |
-
|
405 |
-
|
406 |
-
|
407 |
-
|
408 |
-
|
409 |
-
prediction.wait()
|
410 |
-
|
411 |
-
if prediction.status == 'failed':
|
412 |
-
print(f"Error: {prediction.error}")
|
413 |
-
print(f"Last Log")
|
414 |
-
print(prediction.logs)
|
415 |
-
elif ((prediction.status == 'succeeded') | (prediction.output != None)):
|
416 |
-
response = requests.get(prediction.output[0])
|
417 |
return response.content
|
418 |
|
419 |
|
@@ -439,7 +431,7 @@ with gr.Blocks(theme = "soft", title="Article Writer") as article_generator:
|
|
439 |
# title = gr.Textbox("", label="Title")
|
440 |
# content = gr.Textbox("", label="Content")
|
441 |
# img_data = gr.Textbox("", label="Content")
|
442 |
-
img = gr.Image(
|
443 |
button_scrap.click(fn=get_image, inputs=inputs, outputs=img)
|
444 |
if __name__ == "__main__":
|
445 |
article_generator.launch(share=False)
|
|
|
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={"prompt":'Phantasmal iridescent, vibrant color, high contrast, award winning, trending in artstation, digital art,' + prompt.strip(),
|
402 |
+
"negative_prompt":'NSFW, cityscape',
|
403 |
+
"width": 1648,
|
404 |
+
"height":1024}
|
405 |
+
)
|
406 |
+
gambar = output
|
407 |
+
image_url = gambar[0]
|
408 |
+
response = requests.get(image_url)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
409 |
return response.content
|
410 |
|
411 |
|
|
|
431 |
# title = gr.Textbox("", label="Title")
|
432 |
# content = gr.Textbox("", label="Content")
|
433 |
# img_data = gr.Textbox("", label="Content")
|
434 |
+
img = gr.Image()
|
435 |
button_scrap.click(fn=get_image, inputs=inputs, outputs=img)
|
436 |
if __name__ == "__main__":
|
437 |
article_generator.launch(share=False)
|