Spaces:
Running
Running
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
from model_utils import load_model, generate_code
|
3 |
+
from binary_utils import binary_to_text, text_to_binary
|
4 |
+
|
5 |
+
st.title("🧠 Binary Clone Generator using GenAI")
|
6 |
+
|
7 |
+
binary_input = st.text_area("Enter Binary Input (from primary SoC)", height=200)
|
8 |
+
|
9 |
+
if binary_input:
|
10 |
+
st.subheader("🔍 Converting Binary to Text")
|
11 |
+
original_text = binary_to_text(binary_input)
|
12 |
+
st.code(original_text, language='text')
|
13 |
+
|
14 |
+
if st.button("🛠 Generate Replica for Secondary SoC"):
|
15 |
+
st.write("⏳ Loading model and generating...")
|
16 |
+
tokenizer, model = load_model()
|
17 |
+
gen_code = generate_code(tokenizer, model, original_text)
|
18 |
+
|
19 |
+
st.subheader("🎯 Generated Code/Text")
|
20 |
+
st.code(gen_code, language='python')
|
21 |
+
|
22 |
+
st.subheader("📦 Re-converted to Binary for SoC")
|
23 |
+
generated_binary = text_to_binary(gen_code)
|
24 |
+
st.code(generated_binary, language='text')
|