|
|
|
""" |
|
Hugging Face Spaces Entry Point for Corpus Collection Engine |
|
AI-powered platform for preserving Indian cultural heritage |
|
""" |
|
|
|
import gradio as gr |
|
import subprocess |
|
import threading |
|
import time |
|
import sys |
|
import os |
|
|
|
def launch_streamlit(): |
|
"""Launch Streamlit app in background""" |
|
try: |
|
|
|
subprocess.Popen([ |
|
sys.executable, "-m", "streamlit", "run", |
|
"corpus_collection_engine/main.py", |
|
"--server.port=7861", |
|
"--server.address=0.0.0.0", |
|
"--server.headless=true" |
|
]) |
|
except Exception as e: |
|
print(f"Error launching Streamlit: {e}") |
|
|
|
def create_interface(): |
|
"""Create Gradio interface that embeds the Streamlit app""" |
|
|
|
|
|
streamlit_thread = threading.Thread(target=launch_streamlit, daemon=True) |
|
streamlit_thread.start() |
|
|
|
|
|
time.sleep(10) |
|
|
|
|
|
with gr.Blocks( |
|
title="๐ฎ๐ณ Corpus Collection Engine", |
|
theme=gr.themes.Soft(), |
|
css=""" |
|
.gradio-container { |
|
max-width: 100% !important; |
|
padding: 0 !important; |
|
} |
|
iframe { |
|
border-radius: 10px !important; |
|
} |
|
""" |
|
) as demo: |
|
|
|
|
|
gr.HTML(""" |
|
<div style="text-align: center; padding: 25px; background: linear-gradient(135deg, #FF6B35, #F7931E); color: white; margin-bottom: 25px; border-radius: 15px; box-shadow: 0 4px 15px rgba(255,107,53,0.3);"> |
|
<h1 style="margin: 0; font-size: 2.8em; font-weight: bold;">๐ฎ๐ณ Corpus Collection Engine</h1> |
|
<p style="margin: 15px 0 0 0; font-size: 1.3em; opacity: 0.95;">AI-powered platform for preserving Indian cultural heritage</p> |
|
<p style="margin: 10px 0 0 0; font-size: 1em; opacity: 0.8;">No login required โข Start contributing immediately</p> |
|
</div> |
|
""") |
|
|
|
|
|
gr.HTML(""" |
|
<div style="background: white; border-radius: 15px; overflow: hidden; box-shadow: 0 8px 25px rgba(0,0,0,0.1); margin-bottom: 25px;"> |
|
<iframe |
|
src="http://localhost:7861" |
|
width="100%" |
|
height="850px" |
|
frameborder="0" |
|
style="border-radius: 15px;" |
|
allow="camera; microphone; clipboard-write" |
|
></iframe> |
|
</div> |
|
""") |
|
|
|
|
|
gr.HTML(""" |
|
<div style="background: linear-gradient(135deg, #f8f9fa, #e9ecef); padding: 25px; border-radius: 15px; margin-top: 20px;"> |
|
<h3 style="text-align: center; margin: 0 0 20px 0; color: #333; font-size: 1.5em;">๐ฏ Cultural Activities Available</h3> |
|
<div style="display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 20px; margin-top: 20px;"> |
|
<div style="text-align: center; padding: 20px; background: white; border-radius: 12px; box-shadow: 0 4px 10px rgba(0,0,0,0.1);"> |
|
<div style="font-size: 3em; margin-bottom: 10px;">๐ญ</div> |
|
<h4 style="margin: 0 0 8px 0; color: #FF6B35;">Meme Creator</h4> |
|
<p style="margin: 0; color: #666; font-size: 0.9em;">Create culturally relevant memes in Indian languages</p> |
|
</div> |
|
<div style="text-align: center; padding: 20px; background: white; border-radius: 12px; box-shadow: 0 4px 10px rgba(0,0,0,0.1);"> |
|
<div style="font-size: 3em; margin-bottom: 10px;">๐</div> |
|
<h4 style="margin: 0 0 8px 0; color: #FF6B35;">Recipe Collector</h4> |
|
<p style="margin: 0; color: #666; font-size: 0.9em;">Share traditional family recipes with cultural context</p> |
|
</div> |
|
<div style="text-align: center; padding: 20px; background: white; border-radius: 12px; box-shadow: 0 4px 10px rgba(0,0,0,0.1);"> |
|
<div style="font-size: 3em; margin-bottom: 10px;">๐</div> |
|
<h4 style="margin: 0 0 8px 0; color: #FF6B35;">Folklore Archive</h4> |
|
<p style="margin: 0; color: #666; font-size: 0.9em;">Preserve stories, legends, and oral traditions</p> |
|
</div> |
|
<div style="text-align: center; padding: 20px; background: white; border-radius: 12px; box-shadow: 0 4px 10px rgba(0,0,0,0.1);"> |
|
<div style="font-size: 3em; margin-bottom: 10px;">๐๏ธ</div> |
|
<h4 style="margin: 0 0 8px 0; color: #FF6B35;">Landmark Identifier</h4> |
|
<p style="margin: 0; color: #666; font-size: 0.9em;">Document historical and cultural landmarks</p> |
|
</div> |
|
</div> |
|
|
|
<div style="text-align: center; margin-top: 25px; padding: 20px; background: rgba(255,107,53,0.1); border-radius: 10px;"> |
|
<h4 style="margin: 0 0 10px 0; color: #FF6B35;">๐ Platform Features</h4> |
|
<p style="margin: 0; color: #555; line-height: 1.6;"> |
|
<strong>๐ 11 Indian Languages</strong> โข |
|
<strong>๐ฑ Mobile Responsive</strong> โข |
|
<strong>๐ Privacy-First Design</strong> โข |
|
<strong>๐ Real-time Analytics</strong> โข |
|
<strong>๐ Achievement System</strong> โข |
|
<strong>โก Offline Support</strong> |
|
</p> |
|
</div> |
|
</div> |
|
""") |
|
|
|
|
|
gr.HTML(""" |
|
<div style="text-align: center; padding: 20px; margin-top: 20px; color: #666; border-top: 1px solid #eee;"> |
|
<p style="margin: 0; font-size: 0.9em;"> |
|
Built with โค๏ธ for preserving Indian cultural heritage โข |
|
<strong>Start contributing today!</strong> |
|
</p> |
|
</div> |
|
""") |
|
|
|
return demo |
|
|
|
if __name__ == "__main__": |
|
|
|
demo = create_interface() |
|
demo.launch( |
|
server_port=7860, |
|
server_name="0.0.0.0", |
|
share=False, |
|
show_error=True, |
|
show_api=False |
|
) |