AGayathriiii/DotNetJavaCodeConversion
0
1import streamlit as st
2from backend.model_router import route_model_conversion
3
4st.set_page_config(
5 page_title="C# to Java with Large Language Models ๐",
6 layout="wide",
7 page_icon="โจ"
8)
9
10st.markdown("""
11 <div style="text-align: center; padding: 20px 10px;">
12 <h1 style="color: #6C63FF; font-size: 3em;">๐ฆ The Enchanted Code Converter: .NET to Java</h1>
13 <p style="color: #999; font-size: 1.2em;">โจ "Code it like a CEO. Convert it like a GEN_AI Innovator." โจ</p>
14 <p style="color: #FF69B4;">The cutest way to switch your code from serious C# to jazzy Java ๐</p>
15 </div>
16""", unsafe_allow_html=True)
17
18st.markdown("<hr style='border-top: 2px dashed #eee;'>", unsafe_allow_html=True)
19
20st.subheader("๐ช Choose your Magic Model:")
21model_option = st.selectbox(
22 "โจ Yours model box:",
23 options=[
24 "mistralai/Mistral-7B-Instruct-v0.2",
25 "mistralai/Mixtral-8x7B-Instruct-v0.1",
26 "Salesforce/codegen2-1B"
27 ],
28 index=0
29)
30
31st.markdown("#### ๐๏ธ Paste your <span style='color:#6C63FF;'>C# Code</span> below:", unsafe_allow_html=True)
32cs_code = st.text_area("๐ฅ Your C# Code", height=250, placeholder="// Type some cool C# code...")
33
34convert = st.button("โจ Convert with LLM's โจ")
35
36if convert:
37 with st.spinner("๐ง PowerBrain is thinking... sprinkling AI dust... ๐ญโจ"):
38 result = route_model_conversion(model_option, cs_code)
39 if result:
40 st.balloons()
41 st.success("๐ Tadaa! Here's your Java code, boss!")
42 st.code(result, language="java")
43 else:
44 st.error("๐จ Oopsie daisy! Something went wrong... maybe the code got shy? ๐ฅบ")
45
46st.markdown("""
47 <hr style="border-top: 2px solid #eee;">
48 <div style='text-align: center; color: #aaa; font-size: 0.9em;'>
49 ๐ ๏ธ Made with Large Language Models by <br>
50 <span style="font-size: 1.3em; font-weight: bold; color: #6C63FF;">Apoorva Vutukuru</span> โจ <br>
51 <i>Crafted for GEN_AI Innovators everywhere!</i>
52 </div>
53""", unsafe_allow_html=True)
54 