Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,5 +1,4 @@
|
|
1 |
import streamlit as st
|
2 |
-
from PIL import Image
|
3 |
from ibm_watsonx_ai import APIClient
|
4 |
from ibm_watsonx_ai import Credentials
|
5 |
from ibm_watsonx_ai.foundation_models import ModelInference
|
@@ -61,12 +60,27 @@ if api_key and project_id:
|
|
61 |
Dimensions: {dimensions}\n
|
62 |
Constraints: {constraints}\n
|
63 |
Budget: {budget} USD\n
|
64 |
-
Provide detailed design concepts and
|
65 |
|
66 |
try:
|
67 |
response = model.generate_text(prompt=prompt, params=parameters)
|
68 |
st.success("Generated Design Concepts:")
|
69 |
st.write(response)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
70 |
except Exception as e:
|
71 |
st.error(f"An error occurred: {e}")
|
72 |
|
|
|
1 |
import streamlit as st
|
|
|
2 |
from ibm_watsonx_ai import APIClient
|
3 |
from ibm_watsonx_ai import Credentials
|
4 |
from ibm_watsonx_ai.foundation_models import ModelInference
|
|
|
60 |
Dimensions: {dimensions}\n
|
61 |
Constraints: {constraints}\n
|
62 |
Budget: {budget} USD\n
|
63 |
+
Provide detailed design concepts, explaining how they meet the constraints and budget. Also, suggest alternatives if the current design exceeds the budget or constraints."""
|
64 |
|
65 |
try:
|
66 |
response = model.generate_text(prompt=prompt, params=parameters)
|
67 |
st.success("Generated Design Concepts:")
|
68 |
st.write(response)
|
69 |
+
|
70 |
+
# Follow-up options for further queries
|
71 |
+
st.subheader("Refine Your Design")
|
72 |
+
if st.button("Ask for a cheaper variant"):
|
73 |
+
follow_up_prompt = prompt + "\nPlease suggest a cheaper variant."
|
74 |
+
follow_up_response = model.generate_text(prompt=follow_up_prompt, params=parameters)
|
75 |
+
st.info("Cheaper Variant:")
|
76 |
+
st.write(follow_up_response)
|
77 |
+
|
78 |
+
if st.button("Explore alternative materials"):
|
79 |
+
follow_up_prompt = prompt + "\nPlease explore alternative materials that might better fit the design constraints."
|
80 |
+
follow_up_response = model.generate_text(prompt=follow_up_prompt, params=parameters)
|
81 |
+
st.info("Alternative Materials:")
|
82 |
+
st.write(follow_up_response)
|
83 |
+
|
84 |
except Exception as e:
|
85 |
st.error(f"An error occurred: {e}")
|
86 |
|