| import streamlit as st | |
| from backend.model_router import route_model_conversion | |
| st.set_page_config( | |
| page_title="C# to Java with Large Language Models π", | |
| layout="wide", | |
| page_icon="β¨" | |
| ) | |
| st.markdown(""" | |
| <div style="text-align: center; padding: 20px 10px;"> | |
| <h1 style="color: #6C63FF; font-size: 3em;">π¦ The Enchanted Code Converter: .NET to Java</h1> | |
| <p style="color: #999; font-size: 1.2em;">β¨ "Code it like a CEO. Convert it like a GEN_AI Innovator." β¨</p> | |
| <p style="color: #FF69B4;">The cutest way to switch your code from serious C# to jazzy Java π</p> | |
| </div> | |
| """, unsafe_allow_html=True) | |
| st.markdown("<hr style='border-top: 2px dashed #eee;'>", unsafe_allow_html=True) | |
| st.subheader("πͺ Choose your Magic Model:") | |
| model_option = st.selectbox( | |
| "β¨ Yours model box:", | |
| options=[ | |
| "mistralai/Mistral-7B-Instruct-v0.2", | |
| "mistralai/Mixtral-8x7B-Instruct-v0.1", | |
| "Salesforce/codegen2-1B" | |
| ], | |
| index=0 | |
| ) | |
| st.markdown("#### ποΈ Paste your <span style='color:#6C63FF;'>C# Code</span> below:", unsafe_allow_html=True) | |
| cs_code = st.text_area("π₯ Your C# Code", height=250, placeholder="// Type some cool C# code...") | |
| convert = st.button("β¨ Convert with LLM's β¨") | |
| if convert: | |
| with st.spinner("π§ PowerBrain is thinking... sprinkling AI dust... πβ¨"): | |
| result = route_model_conversion(model_option, cs_code) | |
| if result: | |
| st.balloons() | |
| st.success("π Tadaa! Here's your Java code, boss!") | |
| st.code(result, language="java") | |
| else: | |
| st.error("π¨ Oopsie daisy! Something went wrong... maybe the code got shy? π₯Ί") | |
| st.markdown(""" | |
| <hr style="border-top: 2px solid #eee;"> | |
| <div style='text-align: center; color: #aaa; font-size: 0.9em;'> | |
| π οΈ Made with Large Language Models by <br> | |
| <span style="font-size: 1.3em; font-weight: bold; color: #6C63FF;">Apoorva Vutukuru</span> β¨ <br> | |
| <i>Crafted for GEN_AI Innovators everywhere!</i> | |
| </div> | |
| """, unsafe_allow_html=True) | |