Spaces:
Running
Running
Doubleupai
commited on
Commit
•
1928e0b
1
Parent(s):
4a4fb8d
create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Image Generator with Streamlit
|
2 |
+
|
3 |
+
```python
|
4 |
+
import streamlit as st
|
5 |
+
from PIL import Image
|
6 |
+
import requests
|
7 |
+
from io import BytesIO
|
8 |
+
|
9 |
+
st.title("Image Generator")
|
10 |
+
|
11 |
+
prompt = st.text_input("Enter your prompt:")
|
12 |
+
if st.button("Generate Image"):
|
13 |
+
response = requests.get(f"https://api.example.com/generate?prompt={prompt}")
|
14 |
+
img = Image.open(BytesIO(response.content))
|
15 |
+
st.image(img, caption="Generated Image", use_column_width=True)
|
16 |
+
|