Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -58,22 +58,5 @@ def main():
|
|
| 58 |
if plant_info["image_url"]:
|
| 59 |
st.image(plant_info["image_url"], caption=plant_info["name"], width=300)
|
| 60 |
|
| 61 |
-
# Section 2: Ask a question about the plant
|
| 62 |
-
st.header("Ask a Question About the Plant")
|
| 63 |
-
question = st.text_input("Enter your question about the plant", "")
|
| 64 |
-
|
| 65 |
-
if st.button("Ask"):
|
| 66 |
-
if question.strip():
|
| 67 |
-
# Use the plant's description as context for the question-answering model
|
| 68 |
-
context = plant_info["description"]
|
| 69 |
-
result = qa_pipeline(question=question, context=context)
|
| 70 |
-
st.write(f"**Answer:** {result['answer']}")
|
| 71 |
-
else:
|
| 72 |
-
st.warning("Please enter a valid question.")
|
| 73 |
-
else:
|
| 74 |
-
st.error("Plant not found. Try another name.")
|
| 75 |
-
else:
|
| 76 |
-
st.warning("Please enter a valid plant name.")
|
| 77 |
-
|
| 78 |
if __name__ == "__main__":
|
| 79 |
main()
|
|
|
|
| 58 |
if plant_info["image_url"]:
|
| 59 |
st.image(plant_info["image_url"], caption=plant_info["name"], width=300)
|
| 60 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 61 |
if __name__ == "__main__":
|
| 62 |
main()
|