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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
Devrayog AI - Gradio Web App
|
| 3 |
+
Deployed on Hugging Face Spaces
|
| 4 |
+
"""
|
| 5 |
+
|
| 6 |
+
import gradio as gr
|
| 7 |
+
import requests
|
| 8 |
+
import json
|
| 9 |
+
import os
|
| 10 |
+
import time
|
| 11 |
+
|
| 12 |
+
# API endpoint (will be updated after deployment)
|
| 13 |
+
API_URL = os.environ.get("API_URL", "https://devrayog-ai.hf.space")
|
| 14 |
+
|
| 15 |
+
def chat_with_devrayog(message, model_name, system_prompt):
|
| 16 |
+
"""Send chat request to Devrayog AI API"""
|
| 17 |
+
|
| 18 |
+
if not message.strip():
|
| 19 |
+
return "Please enter a message."
|
| 20 |
+
|
| 21 |
+
# For now, provide a working demo response
|
| 22 |
+
# In production, this will call the actual model API
|
| 23 |
+
|
| 24 |
+
model_responses = {
|
| 25 |
+
"Devrayog Agni (Fast)": f"๐ฅ [Agni - Fast Response]\n\nThank you for your message: '{message}'\n\nI'm Devrayog Agni, the fast model optimized for quick responses. I can help you with:\n- Quick answers\n- Coding help\n- Daily tasks\n- SSB preparation\n\nHow can I assist you further?",
|
| 26 |
+
|
| 27 |
+
"Devrayog Vayu (Creative)": f"๐ [Vayu - Creative Response]\n\nYour message: '{message}'\n\nI'm Devrayog Vayu, the creative model. I excel at:\n- Storytelling and creative writing\n- Brainstorming ideas\n- Content generation\n- Imaginative responses\n\nLet me craft something special for you!",
|
| 28 |
+
|
| 29 |
+
"Devrayog Akash (Powerful)": f"๐ [Akash - Deep Response]\n\nAnalyzing your message: '{message}'\n\nI'm Devrayog Akash, the most powerful model. I specialize in:\n- Complex reasoning\n- Deep analysis\n- Research tasks\n- Multi-step problem solving\n\nLet me provide a comprehensive response."
|
| 30 |
+
}
|
| 31 |
+
|
| 32 |
+
response = model_responses.get(model_name, model_responses["Devrayog Agni (Fast)"])
|
| 33 |
+
|
| 34 |
+
if system_prompt:
|
| 35 |
+
response = f"[System: {system_prompt}]\n\n{response}"
|
| 36 |
+
|
| 37 |
+
return response
|
| 38 |
+
|
| 39 |
+
def get_model_info():
|
| 40 |
+
"""Get information about available models"""
|
| 41 |
+
return """
|
| 42 |
+
## Devrayog AI Models
|
| 43 |
+
|
| 44 |
+
### ๐ฅ Devrayog Agni (Fast)
|
| 45 |
+
- **Parameters:** 3.8B
|
| 46 |
+
- **Base:** Phi-3-mini-4k-instruct
|
| 47 |
+
- **Best for:** Quick responses, coding, daily tasks
|
| 48 |
+
|
| 49 |
+
### ๐ Devrayog Vayu (Creative)
|
| 50 |
+
- **Parameters:** 9B
|
| 51 |
+
- **Base:** Gemma-2-9b-it
|
| 52 |
+
- **Best for:** Storytelling, brainstorming, content
|
| 53 |
+
|
| 54 |
+
### ๐ Devrayog Akash (Powerful)
|
| 55 |
+
- **Parameters:** 8B
|
| 56 |
+
- **Base:** Llama-3.1-8B-Instruct
|
| 57 |
+
- **Best for:** Complex reasoning, analysis, research
|
| 58 |
+
|
| 59 |
+
---
|
| 60 |
+
|
| 61 |
+
**Founder:** Devanshu Sharma (Hermes), Age 18, Neem Ka Thana, Rajasthan
|
| 62 |
+
|
| 63 |
+
**Tagline:** India's First Solo-Built AI
|
| 64 |
+
"""
|
| 65 |
+
|
| 66 |
+
# Create Gradio interface
|
| 67 |
+
with gr.Blocks(
|
| 68 |
+
title="Devrayog AI - India's First Solo-Built AI",
|
| 69 |
+
theme=gr.themes.Soft(),
|
| 70 |
+
css="""
|
| 71 |
+
.gradio-container {font-family: 'Segoe UI', sans-serif;}
|
| 72 |
+
.main-title {text-align: center; color: #FF6B35;}
|
| 73 |
+
"""
|
| 74 |
+
) as demo:
|
| 75 |
+
|
| 76 |
+
gr.Markdown("# ๐ฎ๐ณ Devrayog AI", elem_classes=["main-title"])
|
| 77 |
+
gr.Markdown("*India's First Solo-Built AI - Founded by Devanshu Sharma (Hermes), Age 18, Neem Ka Thana, Rajasthan*")
|
| 78 |
+
|
| 79 |
+
with gr.Tab("๐ฌ Chat"):
|
| 80 |
+
with gr.Row():
|
| 81 |
+
with gr.Column(scale=3):
|
| 82 |
+
chat_input = gr.Textbox(
|
| 83 |
+
label="Your Message",
|
| 84 |
+
placeholder="Type your message here...",
|
| 85 |
+
lines=3
|
| 86 |
+
)
|
| 87 |
+
|
| 88 |
+
model_select = gr.Dropdown(
|
| 89 |
+
choices=[
|
| 90 |
+
"Devrayog Agni (Fast)",
|
| 91 |
+
"Devrayog Vayu (Creative)",
|
| 92 |
+
"Devrayog Akash (Powerful)"
|
| 93 |
+
],
|
| 94 |
+
value="Devrayog Agni (Fast)",
|
| 95 |
+
label="Select Model"
|
| 96 |
+
)
|
| 97 |
+
|
| 98 |
+
system_prompt_input = gr.Textbox(
|
| 99 |
+
label="System Prompt (Optional)",
|
| 100 |
+
placeholder="Set a custom system prompt...",
|
| 101 |
+
lines=2
|
| 102 |
+
)
|
| 103 |
+
|
| 104 |
+
chat_btn = gr.Button("Send ๐", variant="primary")
|
| 105 |
+
|
| 106 |
+
with gr.Column(scale=2):
|
| 107 |
+
chat_output = gr.Textbox(
|
| 108 |
+
label="Response",
|
| 109 |
+
lines=10,
|
| 110 |
+
interactive=False
|
| 111 |
+
)
|
| 112 |
+
|
| 113 |
+
chat_btn.click(
|
| 114 |
+
fn=chat_with_devrayog,
|
| 115 |
+
inputs=[chat_input, model_select, system_prompt_input],
|
| 116 |
+
outputs=chat_output
|
| 117 |
+
)
|
| 118 |
+
|
| 119 |
+
with gr.Tab("๐ Model Info"):
|
| 120 |
+
gr.Markdown(get_model_info())
|
| 121 |
+
|
| 122 |
+
with gr.Tab("๐ฏ SSB Prep"):
|
| 123 |
+
gr.Markdown("""
|
| 124 |
+
## SSB Interview Preparation
|
| 125 |
+
|
| 126 |
+
### 5-Day SSB Process
|
| 127 |
+
1. **Day 1 - Screening:** OIR Test + PPDT
|
| 128 |
+
2. **Day 2 - Psychology:** TAT, WAT, SRT, SD
|
| 129 |
+
3. **Day 3-4 - GTO Tasks:** GD, GPE, PGT, HGT, Command Task, FGT
|
| 130 |
+
4. **Day 5 - Conference:** Final Result
|
| 131 |
+
|
| 132 |
+
### 15 Officer-Like Qualities (OLQs)
|
| 133 |
+
1. Effective Intelligence
|
| 134 |
+
2. Reasoning Ability
|
| 135 |
+
3. Organizing Ability
|
| 136 |
+
4. Power of Expression
|
| 137 |
+
5. Social Adaptability
|
| 138 |
+
6. Cooperation
|
| 139 |
+
7. Sense of Responsibility
|
| 140 |
+
8. Initiative
|
| 141 |
+
9. Self Confidence
|
| 142 |
+
10. Speed of Decision
|
| 143 |
+
11. Ability to Influence the Group
|
| 144 |
+
12. Liveliness
|
| 145 |
+
13. Determination
|
| 146 |
+
14. Courage
|
| 147 |
+
15. Stamina
|
| 148 |
+
|
| 149 |
+
### Quick Tips
|
| 150 |
+
- Be yourself, don't fake
|
| 151 |
+
- Practice OIR daily
|
| 152 |
+
- Write 6 TAT stories daily
|
| 153 |
+
- Stay updated with current affairs
|
| 154 |
+
- Maintain physical fitness
|
| 155 |
+
- Be confident but humble
|
| 156 |
+
""")
|
| 157 |
+
|
| 158 |
+
with gr.Tab("โน๏ธ About"):
|
| 159 |
+
gr.Markdown("""
|
| 160 |
+
## About Devrayog AI
|
| 161 |
+
|
| 162 |
+
**Devrayog AI** is India's first solo-built AI company, founded by **Devanshu Sharma (Hermes)**, an 18-year-old from Neem Ka Thana, Rajasthan.
|
| 163 |
+
|
| 164 |
+
### Mission
|
| 165 |
+
To build India's most accessible and powerful AI, created by a young Indian founder from a small town.
|
| 166 |
+
|
| 167 |
+
### Models
|
| 168 |
+
- **Devrayog Agni** - Fast and sharp (3.8B)
|
| 169 |
+
- **Devrayog Vayu** - Creative and flowing (9B)
|
| 170 |
+
- **Devrayog Akash** - Most powerful (8B)
|
| 171 |
+
|
| 172 |
+
### Contact
|
| 173 |
+
- Hugging Face: https://huggingface.co/dev2089
|
| 174 |
+
- Founder: Devanshu Sharma (Hermes)
|
| 175 |
+
|
| 176 |
+
---
|
| 177 |
+
|
| 178 |
+
*Built with โค๏ธ in India ๐ฎ๐ณ*
|
| 179 |
+
""")
|
| 180 |
+
|
| 181 |
+
# Launch the app
|
| 182 |
+
if __name__ == "__main__":
|
| 183 |
+
demo.launch(server_name="0.0.0.0", server_port=7860)
|