Nepjune commited on
Commit
ae501df
·
verified ·
1 Parent(s): 5d63c4f

Delete Front.js

Browse files
Files changed (1) hide show
  1. Front.js +0 -44
Front.js DELETED
@@ -1,44 +0,0 @@
1
- import React, { useState } from "react";
2
- import axios from "axios";
3
-
4
- function App() {
5
- const [image, setImage] = useState(null);
6
- const [caption, setCaption] = useState(null);
7
-
8
- const handleImageChange = (event) => {
9
- const file = event.target.files[0];
10
- const reader = new FileReader();
11
-
12
- reader.onload = () => {
13
- setImage(reader.result);
14
- };
15
-
16
- reader.readAsDataURL(file);
17
- };
18
-
19
- const handleSubmit = () => {
20
- const formData = new FormData();
21
- formData.append("image", image);
22
-
23
- axios.post("/caption", formData)
24
- .then((response) => response.data)
25
- .then((data) => {
26
- setCaption(data.caption);
27
- });
28
- };
29
-
30
- return (
31
- <div>
32
- <h1>Image Captioning with BLIP</h1>
33
- <p>ระบบนี้ใช้ BLIP เพื่อสร้างคำอธิบายภาพ</p>
34
- <form onSubmit={handleSubmit}>
35
- <input type="file" name="image" id="image" onChange={handleImageChange} />
36
- <label for="image">เลือกภาพ</label>
37
- <input type="submit" value="สร้างคำอธิบาย" />
38
- </form>
39
- {caption && <p>{caption}</p>}
40
- </div>
41
- );
42
- };
43
-
44
- export default App;