Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -33,17 +33,22 @@ except Exception as e:
|
|
33 |
st.error(f"An error occurred: {e}")
|
34 |
|
35 |
def generate_image_from_model(prompt):
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
|
|
|
|
|
|
41 |
def generate_image(prompt):
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
|
|
|
|
47 |
# Streamlit app
|
48 |
def main():
|
49 |
try:
|
|
|
33 |
st.error(f"An error occurred: {e}")
|
34 |
|
35 |
def generate_image_from_model(prompt):
|
36 |
+
try:
|
37 |
+
response = requests.post(API_URL, headers=headers, json={"inputs": prompt})
|
38 |
+
image_bytes = response.content
|
39 |
+
image = Image.open(io.BytesIO(image_bytes))
|
40 |
+
return image
|
41 |
+
except Exception as e:
|
42 |
+
st.error(f"Error occurs:{e}")
|
43 |
+
|
44 |
def generate_image(prompt):
|
45 |
+
try:
|
46 |
+
response = requests.post(API_URL, headers=headers, json={"inputs": prompt})
|
47 |
+
image_bytes = response.content
|
48 |
+
image = Image.open(io.BytesIO(image_bytes))
|
49 |
+
return image
|
50 |
+
except Exception as e:
|
51 |
+
st.error(f"Error occurs:{e}")
|
52 |
# Streamlit app
|
53 |
def main():
|
54 |
try:
|