Upload app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import streamlit as st
|
| 2 |
+
from diffusers import DiffusionPipeline
|
| 3 |
+
from PIL import Image
|
| 4 |
+
|
| 5 |
+
# Modeli yükle
|
| 6 |
+
pipe = DiffusionPipeline.from_pretrained("PRAMAY3000/floor-plan-generation")
|
| 7 |
+
|
| 8 |
+
# Streamlit arayüzü
|
| 9 |
+
st.title("Floor Plan Generator")
|
| 10 |
+
st.write("Create a floor plan based on your description!")
|
| 11 |
+
|
| 12 |
+
# Kullanıcıdan girdi alın
|
| 13 |
+
prompt = st.text_input("Enter the description for the floor plan:", "2 rooms one living room architectural floor plan draw")
|
| 14 |
+
|
| 15 |
+
if st.button("Generate Floor Plan"):
|
| 16 |
+
# Görüntü oluştur
|
| 17 |
+
image = pipe(prompt).images[0]
|
| 18 |
+
|
| 19 |
+
# Görüntüyü göster
|
| 20 |
+
st.image(image, caption="Generated Floor Plan", use_column_width=True)
|
| 21 |
+
|
| 22 |
+
# Görüntüyü kaydetme
|
| 23 |
+
image_path = "generated_floor_plan.png"
|
| 24 |
+
image.save(image_path)
|
| 25 |
+
|
| 26 |
+
# Kullanıcıya dosya indirme linki sağla
|
| 27 |
+
st.download_button(
|
| 28 |
+
label="Download Floor Plan",
|
| 29 |
+
data=open(image_path, "rb").read(),
|
| 30 |
+
file_name=image_path,
|
| 31 |
+
mime="image/png"
|
| 32 |
+
)
|