Spaces:
Running
Running
Upload app.py with huggingface_hub
Browse files3 unmodified lines45678910111213141516171819202122232425262728293031324 unmodified lines3738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501 unmodified line15215315415515615715810 unmodified lines1691701711721731741751761771781791801811821833 unmodified lines"""import gradio as grimport requestsimport jsonimport osimport time# API endpoint (will be updated after deployment)API_URL = os.environ.get("API_URL", "https://devrayog-ai.hf.space")def chat_with_devrayog(message, model_name, system_prompt):"""Send chat request to Devrayog AI API"""if not message.strip():return "Please enter a message."# For now, provide a working demo response# In production, this will call the actual model APImodel_responses = {"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?","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!","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."}response = model_responses.get(model_name, model_responses["Devrayog Agni (Fast)"])4 unmodified linesreturn responsedef get_model_info():"""Get information about available models"""return """## Devrayog AI Models### ๐ฅ Devrayog Agni (Fast)- **Parameters:** 3.8B- **Base:** Phi-3-mini-4k-instruct- **Best for:** Quick responses, coding, daily tasks### ๐ Devrayog Vayu (Creative)- **Parameters:** 9B- **Base:** Gemma-2-9b-it- **Best for:** Storytelling, brainstorming, content### ๐ Devrayog Akash (Powerful)- **Parameters:** 8B- **Base:** Llama-3.1-8B-Instruct- **Best for:** Complex reasoning, analysis, research---**Founder:** Devanshu Sharma (Hermes), Age 18, Neem Ka Thana, Rajasthan**Tagline:** India's First Solo-Built AI"""# Create Gradio interfacewith gr.Blocks(title="Devrayog AI - India's First Solo-Built AI",theme=gr.themes.Soft(),css=""".gradio-container {font-family: 'Segoe UI', sans-serif;}.main-title {text-align: center; color: #FF6B35;}""") as demo:gr.Markdown("# ๐ฎ๐ณ Devrayog AI", elem_classes=["main-title"])gr.Markdown("*India's First Solo-Built AI - Founded by Devanshu Sharma (Hermes), Age 18, Neem Ka Thana, Rajasthan*")with gr.Tab("๐ฌ Chat"):with gr.Row():with gr.Column(scale=3):chat_input = gr.Textbox(label="Your Message",placeholder="Type your message here...",lines=3)model_select = gr.Dropdown(choices=["Devrayog Agni (Fast)","Devrayog Vayu (Creative)","Devrayog Akash (Powerful)"],value="Devrayog Agni (Fast)",label="Select Model")system_prompt_input = gr.Textbox(label="System Prompt (Optional)",placeholder="Set a custom system prompt...",lines=2)chat_btn = gr.Button("Send ๐", variant="primary")with gr.Column(scale=2):chat_output = gr.Textbox(label="Response",lines=10,interactive=False)chat_btn.click(fn=chat_with_devrayog,inputs=[chat_input, model_select, system_prompt_input],outputs=chat_output)with gr.Tab("๐ Model Info"):gr.Markdown(get_model_info())with gr.Tab("๐ฏ SSB Prep"):gr.Markdown("""## SSB Interview Preparation### 5-Day SSB Process1. **Day 1 - Screening:** OIR Test + PPDT2. **Day 2 - Psychology:** TAT, WAT, SRT, SD3. **Day 3-4 - GTO Tasks:** GD, GPE, PGT, HGT, Command Task, FGT4. **Day 5 - Conference:** Final Result### 15 Officer-Like Qualities (OLQs)1. Effective Intelligence2. Reasoning Ability3. Organizing Ability4. Power of Expression5. Social Adaptability6. Cooperation7. Sense of Responsibility8. Initiative9. Self Confidence10. Speed of Decision11. Ability to Influence the Group12. Liveliness13. Determination14. Courage15. Stamina### Quick Tips- Be yourself, don't fake1 unmodified line- Write 6 TAT stories daily- Stay updated with current affairs- Maintain physical fitness- Be confident but humble""")with gr.Tab("โน๏ธ About"):10 unmodified lines- **Devrayog Vayu** - Creative and flowing (9B)- **Devrayog Akash** - Most powerful (8B)### Contact- Hugging Face: https://huggingface.co/dev2089- Founder: Devanshu Sharma (Hermes)---*Built with โค๏ธ in India ๐ฎ๐ณ*""")# Launch the appif __name__ == "__main__":demo.launch(server_name="0.0.0.0", server_port=7860)3 unmodified lines4567891011121314151617181920212223244 unmodified lines2930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081821 unmodified line84858687888910 unmodified lines1001011021031041051061071081091101111123 unmodified lines"""import gradio as grimport jsonimport timedef chat_with_devrayog(message, model_name, system_prompt):"""Send chat request to Devrayog AI"""if not message.strip():return "Please enter a message."model_responses = {"Devrayog Agni (Fast)": f"๐ฅ [Devrayog 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?","Devrayog Vayu (Creative)": f"๐ [Devrayog 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!","Devrayog Akash (Powerful)": f"๐ [Devrayog 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."}response = model_responses.get(model_name, model_responses["Devrayog Agni (Fast)"])4 unmodified linesreturn responsedef get_model_info():return """## Devrayog AI Models### ๐ฅ Devrayog Agni (Fast) - 3.8B parametersBest for: Quick responses, coding, daily tasks### ๐ Devrayog Vayu (Creative) - 9B parametersBest for: Storytelling, brainstorming, content generation### ๐ Devrayog Akash (Powerful) - 8B parametersBest for: Complex reasoning, analysis, research---**Founder:** Devanshu Sharma (Hermes), Age 18, Neem Ka Thana, Rajasthan**Tagline:** India's First Solo-Built AI"""# Create Gradio interfacewith gr.Blocks(title="Devrayog AI") as demo:gr.Markdown("# ๐ฎ๐ณ Devrayog AI")gr.Markdown("*India's First Solo-Built AI - Founded by Devanshu Sharma (Hermes), Age 18, Rajasthan*")with gr.Tab("๐ฌ Chat"):chat_input = gr.Textbox(label="Your Message", placeholder="Type your message here...", lines=3)model_select = gr.Dropdown(choices=["Devrayog Agni (Fast)", "Devrayog Vayu (Creative)", "Devrayog Akash (Powerful)"],value="Devrayog Agni (Fast)",label="Select Model")system_prompt_input = gr.Textbox(label="System Prompt (Optional)", placeholder="Set a custom system prompt...", lines=2)chat_btn = gr.Button("Send ๐", variant="primary")chat_output = gr.Textbox(label="Response", lines=10, interactive=False)chat_btn.click(fn=chat_with_devrayog, inputs=[chat_input, model_select, system_prompt_input], outputs=chat_output)with gr.Tab("๐ Models"):gr.Markdown(get_model_info())with gr.Tab("๐ฏ SSB Prep"):gr.Markdown("""## SSB Interview Preparation### 5-Day Process- **Day 1:** Screening (OIR + PPDT)- **Day 2:** Psychology (TAT, WAT, SRT, SD)- **Day 3-4:** GTO Tasks (GD, GPE, PGT, HGT, Command Task, FGT)- **Day 5:** Conference### Quick Tips- Be yourself, don't fake1 unmodified line- Write 6 TAT stories daily- Stay updated with current affairs- Maintain physical fitness""")with gr.Tab("โน๏ธ About"):10 unmodified lines- **Devrayog Vayu** - Creative and flowing (9B)- **Devrayog Akash** - Most powerful (8B)### Links- Hugging Face: https://huggingface.co/dev2089- Founder: Devanshu Sharma (Hermes), Age 18, Rajasthan---*Built with โค๏ธ in India ๐ฎ๐ณ*""")if __name__ == "__main__":demo.launch(server_name="0.0.0.0", server_port=7860)
app.py+31-102