CoolFace
Apppublic

AGayathriiii/DotNetJavaCodeConversion

sourceHugging Faceupdated 1y agoView on Hugging Face
0likes
app.py54 linesDownload Raw Back to root
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