Skip to content

Commit

Permalink
Improved output UI
Browse files Browse the repository at this point in the history
  • Loading branch information
pratiksha-naikk authored Mar 31, 2024
1 parent cd5b729 commit 6852794
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions app/src/Model2.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ function Model2() {

const [values, setValues] = useState([""]);
const [response, setResponse] = useState([""]);
const [flag, setFlag] = useState(false);
const [selectedOption1, setSelectedOption1] = useState([""]);
const [selectedOption2, setSelectedOption2] = useState([""]);
const [selectedOption3, setSelectedOption3] = useState([""]);
Expand Down Expand Up @@ -74,6 +75,7 @@ function Model2() {

const handleSubmit = async(e) => {
e.preventDefault();
setFlag(true);
setValues(values);
try {
const response = await fetch('https://fluence-backend.onrender.com/api/process_input_seasonal', {
Expand Down Expand Up @@ -103,6 +105,7 @@ function Model2() {
else {
setResponse("Some error occured");
}
setFlag(false);
}
catch (error) {
console.error("Error: ", error);
Expand Down Expand Up @@ -249,12 +252,14 @@ function Model2() {
<button className="ModelButton">Predict</button>
</div>

{response && <h3>{response}</h3>}
<div className='ModelOutput'>
{flag && response.length===1 ? (<h3>Please wait for response</h3>) : (<h3>{response}</h3>)}
</div>

</form>

</div>
);
}

export default Model2;
export default Model2;

0 comments on commit 6852794

Please sign in to comment.