File size: 2,138 Bytes
6ca36e0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
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)