Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -634,7 +634,7 @@ else:
|
|
| 634 |
|
| 635 |
|
| 636 |
# Step 4: Multi-Agent Story Explorer
|
| 637 |
-
st.subheader("Step 5: Explore Subtopics via
|
| 638 |
st.write("Select Story Language:")
|
| 639 |
story_language_options = ["English", "Hindi", "Spanish", "French", "German", "Chinese", "Japanese"]
|
| 640 |
story_language = st.radio(
|
|
@@ -655,7 +655,7 @@ if st.button("Run Story Graph"):
|
|
| 655 |
result = st.session_state.rag_system.run_multiagent_storygraph(
|
| 656 |
topic=story_topic,
|
| 657 |
context=story_context,
|
| 658 |
-
language=story_language
|
| 659 |
)
|
| 660 |
|
| 661 |
subtopics = result.get("sub_topic_list", [])
|
|
@@ -670,29 +670,6 @@ if st.button("Run Story Graph"):
|
|
| 670 |
tabs = st.tabs([f"Story {i+1}" for i in range(len(stories))])
|
| 671 |
for i, (tab, story) in enumerate(zip(tabs, stories)):
|
| 672 |
with tab:
|
| 673 |
-
st.markdown("#### ๐จ Concept Visual")
|
| 674 |
-
|
| 675 |
-
# Prompt for the diagram using story language
|
| 676 |
-
visual_prompt = f"""
|
| 677 |
-
A colorful hand-drawn educational illustration in {story_language}, labeled and clear.
|
| 678 |
-
Topic: {story_topic}
|
| 679 |
-
Subtopic: {subtopics[i] if i < len(subtopics) else 'Concept'}
|
| 680 |
-
Style: for middle school students, simple icons, visually intuitive.
|
| 681 |
-
"""
|
| 682 |
-
|
| 683 |
-
try:
|
| 684 |
-
image, _ = infer(
|
| 685 |
-
prompt=visual_prompt,
|
| 686 |
-
seed=42,
|
| 687 |
-
randomize_seed=True,
|
| 688 |
-
width=1024,
|
| 689 |
-
height=1024,
|
| 690 |
-
num_inference_steps=4
|
| 691 |
-
)
|
| 692 |
-
st.image(image, caption="Concept Visual", use_column_width=True)
|
| 693 |
-
except Exception as e:
|
| 694 |
-
st.error(f"Diagram generation failed: {e}")
|
| 695 |
-
|
| 696 |
st.markdown("#### โ๏ธ Story")
|
| 697 |
st.markdown(story.content)
|
| 698 |
else:
|
|
|
|
| 634 |
|
| 635 |
|
| 636 |
# Step 4: Multi-Agent Story Explorer
|
| 637 |
+
st.subheader("Step 5: Explore Subtopics via Stories")
|
| 638 |
st.write("Select Story Language:")
|
| 639 |
story_language_options = ["English", "Hindi", "Spanish", "French", "German", "Chinese", "Japanese"]
|
| 640 |
story_language = st.radio(
|
|
|
|
| 655 |
result = st.session_state.rag_system.run_multiagent_storygraph(
|
| 656 |
topic=story_topic,
|
| 657 |
context=story_context,
|
| 658 |
+
language=story_language
|
| 659 |
)
|
| 660 |
|
| 661 |
subtopics = result.get("sub_topic_list", [])
|
|
|
|
| 670 |
tabs = st.tabs([f"Story {i+1}" for i in range(len(stories))])
|
| 671 |
for i, (tab, story) in enumerate(zip(tabs, stories)):
|
| 672 |
with tab:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 673 |
st.markdown("#### โ๏ธ Story")
|
| 674 |
st.markdown(story.content)
|
| 675 |
else:
|