rishipal commited on
Commit
dca465c
Β·
verified Β·
1 Parent(s): 0257bcf

Upload 4 files

Browse files
Files changed (4) hide show
  1. Readme.md +109 -0
  2. app.py +121 -0
  3. contributing.md +18 -0
  4. requirements.txt +3 -0
Readme.md ADDED
@@ -0,0 +1,109 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # πŸ“š WikiSage – All Wiki Resources for a Topic
2
+
3
+ > πŸ” One Topic. All Wiki. Your Way.
4
+
5
+ ## Team Members
6
+ - Rishi Palavarapu
7
+ - Harsha Ambati
8
+ - Rishitha Reddy
9
+ - Yaswanth Ambati
10
+
11
+ ## 🧠 Overview
12
+
13
+ **WikiSage** is a smart, educational app built for the WikiVerse Hackathon. It allows users to explore **comprehensive information about any topic** by aggregating and organizing resources from across Wikimedia projects like Wikipedia, Wikibooks, Wikiquote, Commons, Wikisource, and more β€” all in one place.
14
+
15
+ ---
16
+
17
+ ## 🎯 Problem Statement
18
+
19
+ Millions of users rely on Wikimedia for learning, but navigating multiple platforms (Wikipedia, Wikibooks, Wikiquote, etc.) to gather full information on a single topic is **time-consuming and fragmented**.
20
+
21
+ There is no unified platform that allows learners to:
22
+
23
+ - Seamlessly explore all types of Wikimedia content (articles, books, quotes, images, source texts) on **one topic**
24
+ - **Access diverse formats of learning content** (definitions, timelines, media, references)
25
+ - Interact with this knowledge in a structured, multilingual, and accessible way
26
+
27
+ ---
28
+
29
+ ## πŸ’‘ Solution
30
+
31
+ **WikiSage** solves this by:
32
+ - Fetching content from multiple Wikimedia public APIs
33
+ - Structuring them into an intuitive, topic-based interface
34
+ - Providing features like multilingual support, content export, and related topic mapping
35
+
36
+ ---
37
+
38
+ ## πŸš€ Features
39
+
40
+ | Feature | Description |
41
+ |--------|-------------|
42
+ | πŸ” **Smart Topic Search** | User inputs a topic (e.g., "Quantum Physics", "Mahatma Gandhi") |
43
+ | πŸ“„ **Knowledge Summary** | Summary and detailed content from Wikipedia |
44
+ | πŸ“š **In-Depth Books** | Structured reading material from Wikibooks |
45
+ | πŸ’¬ **Famous Quotes** | Related quotes using Wikiquote |
46
+ | πŸ“œ **Primary Sources** | Historical documents from Wikisource |
47
+ | πŸ–ΌοΈ **Media Gallery** | Relevant images from Commons |
48
+ | 🧠 **Linked Topics Map** | Visual exploration of related topics via Wikidata |
49
+ | 🌐 **Multilingual Mode** | Pulls topic info in different languages via Wikimedia APIs |
50
+ | πŸ“₯ **Export Feature** | Download topic summary as PDF or Markdown |
51
+
52
+ ---
53
+
54
+ ## 🌐 APIs Used
55
+
56
+ All APIs are strictly from the list approved in the [WikiVerse Hackathon Guidelines](#):
57
+
58
+ | API | Purpose |
59
+ |-----|---------|
60
+ | Wikipedia (`en.wikipedia.org`) | Topic summaries & articles |
61
+ | Wikibooks (`en.wikibooks.org`) | Educational book modules |
62
+ | Wikisource (`en.wikisource.org`) | Primary documents |
63
+ | Wikiquote (`en.wikiquote.org`) | Famous quotes |
64
+ | Commons (`commons.wikimedia.org`) | Media assets (images, posters, etc.) |
65
+ | Wiktionary (`en.wiktionary.org`) | Definitions and multilingual word meanings |
66
+ | Wikidata (`www.wikidata.org`) | Related concepts and metadata |
67
+
68
+ ---
69
+
70
+ ## 🎯 Target Users
71
+
72
+ - πŸ“˜ Students researching a subject
73
+ - 🧠 Self-learners exploring a new topic
74
+ - πŸ‘¨β€πŸ« Educators curating study content
75
+ - πŸ“° Content creators/fact-checkers
76
+ - 🌍 Anyone interested in structured, verified knowledge
77
+
78
+ ---
79
+
80
+ ## πŸ› οΈ Tech Stack
81
+
82
+ - **Frontend**: HTML, CSS, JavaScript / React (choose based on final implementation)
83
+ - **Backend**: Node.js / Python (for API integration & routing)
84
+ - **APIs**: RESTful calls to Wikimedia APIs
85
+ - **Hosting**: GitLab Pages / Local, Streamlit Cloud
86
+
87
+ ---
88
+
89
+ ## πŸ“¦ Project Structure
90
+ | Hour | Phase | Tasks |
91
+ |------|-------------------------------|-----------------------------------------------------------------------|
92
+ | 1 | *Ideation & Planning* | Define app scope, identify APIs needed, finalize features, assign tasks |
93
+ | 2 | *UI/UX & Architecture* | Design layout, multilingual UI, API-client separation, wireframes |
94
+ | 3-5 | *Development Phase* | Build Python backend (API wrappers for Wikipedia, Commons, Wikidata) <br> Build frontend with search UI + display views <br> Integrate AI model for summarization |
95
+ | 6 | *Testing* | Test multilingual search, output display, and error handling |
96
+ | 7 | *Deployment & Refinement* | Final fixes, improve UI, connect frontend to backend APIs |
97
+ | 8 | *Documentation & Pitch Prep*| Finalize README, prepare 5-minute demo and presentation |
98
+
99
+
100
+ ---
101
+
102
+
103
+ ## πŸ“– How to Run Locally
104
+
105
+ ```bash
106
+ git clone https://gitlab.com/your-team/wiki-sage.git
107
+ cd wiki-sage
108
+ npm install
109
+ npm start
app.py ADDED
@@ -0,0 +1,121 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # app.py
2
+ import streamlit as st
3
+ from streamlit.components.v1 import html
4
+ from story_engine.story_builder import build_story
5
+
6
+ st.markdown("""
7
+ <meta name="viewport" content="width=device-width, initial-scale=1">
8
+ """, unsafe_allow_html=True)
9
+
10
+ st.set_page_config(page_title="WikiTales", layout="centered")
11
+
12
+ st.title("πŸ“– WikiTales – Interactive Historical Storybooks")
13
+
14
+ with st.container():
15
+ st.markdown("#### πŸ” Enter a historical figure or event:")
16
+ topic = st.text_input(
17
+ label="Search Topic",
18
+ placeholder="e.g., French Revolution",
19
+ key="search_box",
20
+ label_visibility="collapsed"
21
+ )
22
+
23
+ narrator = st.selectbox(
24
+ "Choose Narrator Voice",
25
+ options=["πŸ“š Neutral Historian", "πŸ“° Wartime Journalist", "πŸ‘©β€πŸŒΎ Eyewitness", "πŸ§™ Fictional Guide", "πŸ€– AI Assistant"],
26
+ index=0
27
+ )
28
+
29
+ # -------------------------
30
+ # Carousel Renderer Function
31
+ # -------------------------
32
+
33
+ def render_image_carousel(images):
34
+ if not images:
35
+ st.warning("No images found.")
36
+ return
37
+
38
+ # Build slides
39
+ slides = ""
40
+ for idx, img in enumerate(images):
41
+ slides += f"""
42
+ <div class="slide" id="slide-{idx}">
43
+ <img src="{img['url']}" alt="{img['title']}" />
44
+ <div class="caption">{img['title']}</div>
45
+ </div>"""
46
+
47
+ html_code = f"""
48
+ <style>
49
+ .carousel {{ position: relative; width: 100%; max-width: 700px; margin: auto; }}
50
+ .slide {{ display: none; text-align: center; }}
51
+ .slide img {{ max-width: 100%; max-height: 350px; border-radius: 8px; }}
52
+ .caption {{ color: #fff; background: rgba(0,0,0,0.5); padding: 0.5em; position: absolute; bottom: 8px; width: 100%; }}
53
+ .prev, .next {{
54
+ cursor: pointer;
55
+ position: absolute;
56
+ top: 50%;
57
+ width: auto;
58
+ margin-top: -22px;
59
+ padding: 16px;
60
+ color: white;
61
+ font-weight: bold;
62
+ font-size: 18px;
63
+ border-radius: 0 3px 3px 0;
64
+ user-select: none;
65
+ }}
66
+ .next {{ right: 0; border-radius: 3px 0 0 3px; }}
67
+ </style>
68
+
69
+ <div class="carousel">
70
+ {slides}
71
+ <a class="prev" onclick="changeSlide(-1)">&#10094;</a>
72
+ <a class="next" onclick="changeSlide(1)">&#10095;</a>
73
+ </div>
74
+
75
+ <script>
76
+ let currentSlide = 0;
77
+ const slides = document.getElementsByClassName('slide');
78
+ function showSlide(idx) {{
79
+ if (idx >= slides.length) currentSlide = 0;
80
+ else if (idx < 0) currentSlide = slides.length - 1;
81
+ else currentSlide = idx;
82
+ for (let i = 0; i < slides.length; i++) {{
83
+ slides[i].style.display = 'none';
84
+ }}
85
+ slides[currentSlide].style.display = 'block';
86
+ }}
87
+ function changeSlide(n) {{
88
+ showSlide(currentSlide + n);
89
+ }}
90
+ showSlide(0);
91
+ </script>
92
+ """
93
+
94
+ html(html_code, height=420)
95
+
96
+ # -------------------------
97
+ # Main Search + Display
98
+ # -------------------------
99
+ if topic:
100
+ with st.spinner(f"Generating story for '{topic}'..."):
101
+ story_data = build_story(topic, narrator)
102
+ story = story_data["story"]
103
+ images = story_data["images"]
104
+ wikibooks = story_data.get("wikibooks", []) # βœ… added
105
+
106
+ if story:
107
+ render_image_carousel(images)
108
+ st.markdown(f"#### πŸŽ™οΈ Narrated by: {narrator}")
109
+ st.markdown("## 🧠 Generated Story")
110
+ with st.container():
111
+ st.markdown(story, unsafe_allow_html=True)
112
+
113
+ # βœ… SIDEBAR: Wikibooks Deep Dive
114
+ if wikibooks:
115
+ with st.sidebar:
116
+ st.markdown("## πŸ“š Learn More on Wikibooks")
117
+ for module in wikibooks:
118
+ st.markdown(f"- [{module['title']}]({module['link']})")
119
+
120
+ else:
121
+ st.error("Sorry, we couldn't build a story. Try another topic.")
contributing.md ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # 🀝 Contributing to WikiSage
2
+
3
+ Welcome to the WikiSage project β€” an open knowledge app built for the WikiVerse Hackathon.
4
+ We’re glad you want to help make it better! 🧠
5
+
6
+ Please follow these guidelines to ensure clean, stable, and collaborative development.
7
+
8
+ ---
9
+
10
+ ## πŸ”§ Setup Instructions
11
+
12
+ To get started:
13
+
14
+ 1. **Clone the repository**:
15
+
16
+ ```bash
17
+ git clone https://gitlab.com/your-team/wiki-sage.git
18
+ cd wiki-sage
requirements.txt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ streamlit
2
+ requests
3
+ beautifulsoup4