File size: 909 Bytes
6103b0d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import streamlit as st
from model_utils import load_model, generate_code
from binary_utils import binary_to_text, text_to_binary

st.title("🧠 Binary Clone Generator using GenAI")

binary_input = st.text_area("Enter Binary Input (from primary SoC)", height=200)

if binary_input:
    st.subheader("πŸ” Converting Binary to Text")
    original_text = binary_to_text(binary_input)
    st.code(original_text, language='text')

    if st.button("πŸ›  Generate Replica for Secondary SoC"):
        st.write("⏳ Loading model and generating...")
        tokenizer, model = load_model()
        gen_code = generate_code(tokenizer, model, original_text)

        st.subheader("🎯 Generated Code/Text")
        st.code(gen_code, language='python')

        st.subheader("πŸ“¦ Re-converted to Binary for SoC")
        generated_binary = text_to_binary(gen_code)
        st.code(generated_binary, language='text')