Dede16 commited on
Commit
fe61deb
·
1 Parent(s): a8618ef

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +22 -26
app.py CHANGED
@@ -394,32 +394,28 @@ 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
- try:
398
- os.environ["REPLICATE_API_TOKEN"] = "r8_KUXOnCBFpGtsxpL2MNUMi9CVYulQjEc0pOlhs"
399
- sdxl_model = replicate.models.get("stability-ai/sdxl")
400
- sdxl_version = sdxl_model.versions.get("a00d0b7dcbb9c3fbb34ba87d2d5b46c56969c84a628bf778a7fdaec30b1b99c5")
401
-
402
- prediction = replicate.predictions.create(version=sdxl_version,
403
- input={"prompt":'Phantasmal iridescent, vibrant color, high contrast, award winning, trending in artstation, digital art' + prompt,
404
- "negative_prompt":'NSFW, cityscape',
405
- "width": 1648,
406
- "height":1024}
407
- )
408
- prediction
409
- prediction.reload()
410
- prediction.wait()
411
-
412
- if prediction.status == 'failed':
413
- print(f"Error: {prediction.error}")
414
- print(f"Last Log")
415
- print(prediction.logs)
416
- elif ((prediction.status == 'succeeded') | (prediction.output != None)):
417
- response = requests.get(prediction.output[0])
418
- image_data = base64.b64encode(response.content)
419
- return image_data
420
- except:
421
- image_data = None
422
- return image_data
423
 
424
  # return tags, content, url #image, image_data
425
 
 
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
+ os.environ["REPLICATE_API_TOKEN"] = "r8_KUXOnCBFpGtsxpL2MNUMi9CVYulQjEc0pOlhs"
398
+ sdxl_model = replicate.models.get("stability-ai/sdxl")
399
+ sdxl_version = sdxl_model.versions.get("a00d0b7dcbb9c3fbb34ba87d2d5b46c56969c84a628bf778a7fdaec30b1b99c5")
400
+
401
+ prediction = replicate.predictions.create(version=sdxl_version,
402
+ input={"prompt":'Phantasmal iridescent, vibrant color, high contrast, award winning, trending in artstation, digital art' + prompt,
403
+ "negative_prompt":'NSFW, cityscape',
404
+ "width": 1648,
405
+ "height":1024}
406
+ )
407
+ prediction
408
+ prediction.reload()
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
 
420
  # return tags, content, url #image, image_data
421