MalikShehram commited on
Commit
cc04223
·
verified ·
1 Parent(s): d7d94c7

Upload 3 files

Browse files
Files changed (3) hide show
  1. frontend/App.jsx +77 -0
  2. frontend/index.css +1 -0
  3. frontend/main.jsx +10 -0
frontend/App.jsx ADDED
@@ -0,0 +1,77 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import { useState } from 'react'
2
+
3
+ function App() {
4
+ const [inputText, setInputText] = useState("Critical satellite telemetry data sequence initialized.")
5
+ const [corruptedText, setCorruptedText] = useState("")
6
+ const [decodedText, setDecodedText] = useState("")
7
+ const [loading, setLoading] = useState(false)
8
+
9
+ const handleTransmit = async () => {
10
+ setLoading(true)
11
+ setCorruptedText("")
12
+ setDecodedText("")
13
+
14
+ try {
15
+ // 1. Send your custom text to the backend
16
+ const response = await fetch('/api/transmit', {
17
+ method: 'POST',
18
+ headers: { 'Content-Type': 'application/json' },
19
+ body: JSON.stringify({ text: inputText })
20
+ })
21
+
22
+ const data = await response.json()
23
+
24
+ // 2. Display the results
25
+ setCorruptedText(data.corrupted)
26
+ setDecodedText(data.decoded)
27
+ } catch (error) {
28
+ setDecodedText("Error connecting to the server.")
29
+ }
30
+ setLoading(false)
31
+ }
32
+
33
+ return (
34
+ <div className="min-h-screen bg-gray-900 text-white p-8 font-sans">
35
+ <div className="max-w-2xl mx-auto space-y-6">
36
+ <h1 className="text-3xl font-bold text-blue-400">🧠 6G Semantic Decoder</h1>
37
+
38
+ {/* The New Text Input Box */}
39
+ <div className="space-y-2">
40
+ <label className="text-sm text-gray-400">Message to Transmit:</label>
41
+ <textarea
42
+ className="w-full p-3 bg-gray-800 rounded border border-gray-700 text-white"
43
+ rows="3"
44
+ value={inputText}
45
+ onChange={(e) => setInputText(e.target.value)}
46
+ />
47
+ </div>
48
+
49
+ <button
50
+ onClick={handleTransmit}
51
+ disabled={loading}
52
+ className="w-full bg-blue-600 hover:bg-blue-500 text-white font-bold py-3 px-4 rounded transition-colors"
53
+ >
54
+ {loading ? "Transmitting..." : "Transmit Message"}
55
+ </button>
56
+
57
+ {/* Display the Corrupted Text */}
58
+ {corruptedText && (
59
+ <div className="p-4 bg-red-900/30 border border-red-700 rounded">
60
+ <h3 className="text-red-400 text-sm font-bold mb-1">Traditional PHY Decoder (Noisy):</h3>
61
+ <p className="font-mono">{corruptedText}</p>
62
+ </div>
63
+ )}
64
+
65
+ {/* Display the AI Decoded Text */}
66
+ {decodedText && (
67
+ <div className="p-4 bg-green-900/30 border border-green-700 rounded">
68
+ <h3 className="text-green-400 text-sm font-bold mb-1">AI Semantic Recovery:</h3>
69
+ <p className="font-mono">{decodedText}</p>
70
+ </div>
71
+ )}
72
+ </div>
73
+ </div>
74
+ )
75
+ }
76
+
77
+ export default App
frontend/index.css ADDED
@@ -0,0 +1 @@
 
 
1
+ @import "tailwindcss";
frontend/main.jsx ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ import React from 'react'
2
+ import ReactDOM from 'react-dom/client'
3
+ import App from './App.jsx'
4
+ import './index.css'
5
+
6
+ ReactDOM.createRoot(document.getElementById('root')).render(
7
+ <React.StrictMode>
8
+ <App />
9
+ </React.StrictMode>,
10
+ )