Spaces:
Runtime error
Runtime error
SusiePHaltmann
commited on
Commit
•
8471888
1
Parent(s):
6cc743e
Request to upload 5.28.22 #1
Browse files
app.py
ADDED
@@ -0,0 +1,57 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from re import I
|
2 |
+
import replicate
|
3 |
+
import st
|
4 |
+
## make a catch 404 statement if there is a bug
|
5 |
+
import streamlit.components.v1 as components
|
6 |
+
## now make a streamalit app gui for pixray text2image
|
7 |
+
import streamlit as st
|
8 |
+
import numpy as np
|
9 |
+
import PIL
|
10 |
+
import PIL.Image
|
11 |
+
import PIL.ImageDraw
|
12 |
+
import PIL.ImageFont
|
13 |
+
import PIL.ImageOps
|
14 |
+
def main():
|
15 |
+
import replicate
|
16 |
+
model = replicate.models.get("pixray/text2image")
|
17 |
+
model.predict(prompts=input("Enter text: "))
|
18 |
+
## make a streamlit app
|
19 |
+
|
20 |
+
|
21 |
+
## make a streamlit app gui for pixray text2image
|
22 |
+
import streamlit as st
|
23 |
+
import numpy as np
|
24 |
+
import PIL
|
25 |
+
import PIL.Image
|
26 |
+
import PIL.ImageDraw
|
27 |
+
import streamlit.components.v1 as components
|
28 |
+
## now make a streamalit app gui for pixray text2image
|
29 |
+
import streamlit as st
|
30 |
+
import numpy as np
|
31 |
+
import PIL
|
32 |
+
import PIL.Image
|
33 |
+
import PIL.ImageDraw
|
34 |
+
import PIL.ImageFont
|
35 |
+
import PIL.ImageOps
|
36 |
+
def main():
|
37 |
+
st.title("Pixray Text2Image")
|
38 |
+
st.markdown("""
|
39 |
+
This app converts text to images.
|
40 |
+
""")
|
41 |
+
st.markdown("""
|
42 |
+
**How to use:**
|
43 |
+
1. Enter text in the text box below.
|
44 |
+
2. Click the button to convert text to an image.
|
45 |
+
3. Click the button to save the image.
|
46 |
+
""")
|
47 |
+
text = st.text_area("Enter text here:", "")
|
48 |
+
if st.button("Convert text to image"):
|
49 |
+
image = model.predict(prompts=text)
|
50 |
+
st.image(image, use_column_width=True)
|
51 |
+
if st.button("Save image"):
|
52 |
+
st.write("Saving image...")
|
53 |
+
image.save("image.png")
|
54 |
+
st.success("Image saved.")
|
55 |
+
|
56 |
+
## v0.1x INFDEV [HALTMANN AGI]
|
57 |
+
|