Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
|
@@ -8,7 +8,6 @@ from threading import Thread
|
|
| 8 |
import discord
|
| 9 |
from discord.ext import tasks
|
| 10 |
from PIL import Image
|
| 11 |
-
from colorama import Fore, Style
|
| 12 |
import streamlit as st
|
| 13 |
from huggingface_hub import InferenceClient, login
|
| 14 |
import time
|
|
@@ -66,6 +65,7 @@ login(HF_TOKEN)
|
|
| 66 |
|
| 67 |
SD = InferenceClient(model="stabilityai/stable-diffusion-2-1")
|
| 68 |
LLM = InferenceClient(model="openchat/openchat-3.5-0106")
|
|
|
|
| 69 |
|
| 70 |
|
| 71 |
def ec(x, fd="<image>", sd="</image>"):
|
|
@@ -195,14 +195,15 @@ async def on_message(message):
|
|
| 195 |
embed.set_image(url=load)
|
| 196 |
image = SD.text_to_image(imgp)
|
| 197 |
image.save("image.png")
|
| 198 |
-
|
|
|
|
|
|
|
| 199 |
embed.set_image(url="attachment://image.png")
|
| 200 |
e.edit(embed=embed, file=file)
|
|
|
|
| 201 |
|
| 202 |
except Exception as e:
|
| 203 |
-
print(Fore.RED)
|
| 204 |
print(e)
|
| 205 |
-
print(Style.RESET_ALL)
|
| 206 |
|
| 207 |
token = os.environ["TOKEN"]
|
| 208 |
client.run(token)
|
|
|
|
| 8 |
import discord
|
| 9 |
from discord.ext import tasks
|
| 10 |
from PIL import Image
|
|
|
|
| 11 |
import streamlit as st
|
| 12 |
from huggingface_hub import InferenceClient, login
|
| 13 |
import time
|
|
|
|
| 65 |
|
| 66 |
SD = InferenceClient(model="stabilityai/stable-diffusion-2-1")
|
| 67 |
LLM = InferenceClient(model="openchat/openchat-3.5-0106")
|
| 68 |
+
RF = InferenceClient(model="stabilityai/stable-diffusion-xl-refiner-1.0")
|
| 69 |
|
| 70 |
|
| 71 |
def ec(x, fd="<image>", sd="</image>"):
|
|
|
|
| 195 |
embed.set_image(url=load)
|
| 196 |
image = SD.text_to_image(imgp)
|
| 197 |
image.save("image.png")
|
| 198 |
+
image = RF.image_to_image("image.png")
|
| 199 |
+
image.save("image.png")
|
| 200 |
+
file = discord.File("image.png", filename="image.png")
|
| 201 |
embed.set_image(url="attachment://image.png")
|
| 202 |
e.edit(embed=embed, file=file)
|
| 203 |
+
|
| 204 |
|
| 205 |
except Exception as e:
|
|
|
|
| 206 |
print(e)
|
|
|
|
| 207 |
|
| 208 |
token = os.environ["TOKEN"]
|
| 209 |
client.run(token)
|