brainai-spaces commited on
Commit
afbd1bc
Β·
verified Β·
1 Parent(s): a96d51d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -28
app.py CHANGED
@@ -9,23 +9,23 @@ import moviepy.editor as mpy
9
  from camera_input_live import camera_input_live
10
 
11
  st.set_page_config(
12
- page_title="Hello Text Detection",
13
  page_icon=":sun_with_face:",
14
  layout="centered",
15
  initial_sidebar_state="expanded",)
16
 
17
- st.title("Hello Text Dection :sun_with_face:")
18
 
19
- st.sidebar.header("Menu")
20
- source_radio = st.sidebar.radio("Select Source", ["IMAGE", "VIDEO", "WEBCAM"])
21
 
22
- st.sidebar.header("Confidence")
23
- conf_threshold = float(st.sidebar.slider("Select the Confidence Threshold", 10, 100, 20))/100
24
 
25
  input = None
26
  if source_radio == "IMAGE":
27
- st.sidebar.header("Upload")
28
- input = st.sidebar.file_uploader("Choose an image.", type=("jpg", "png"))
29
  if input is not None:
30
  uploaded_image = Image.open(input)
31
  uploaded_image_cv = cv2.cvtColor(np.array(uploaded_image), cv2.COLOR_RGB2BGR)
@@ -55,26 +55,7 @@ def play_video(video_source):
55
  visualized_image = utils.convert_result_to_image(frame, resized_image, boxes, conf_labels=False)
56
  except:
57
  visualized_image = frame
58
- st_frame.image(visualized_image, channels = "BGR")
59
- video_row.append(cv2.cvtColor(visualized_image,cv2.COLOR_BGR2RGB))
60
- frame_count +=1
61
- progress_bar.progress(frame_count/total_frames, text=None)
62
-
63
- else:
64
- progress_bar.empty()
65
- camera.release()
66
- st_frame.empty()
67
- break
68
- clip = mpy.ImageSequenceClip(video_row, fps = fps)
69
- clip.write_videofile(temp_file_2.name)
70
- st.video(temp_file_2.name)
71
-
72
- # 파일 μ—…λ‘œλ“œ 처리
73
- temporary_location = None
74
-
75
- if source_radio == "VIDEO":
76
- st.sidebar.header("Upload")
77
- input_file = st.sidebar.file_uploader("Choose a video.", type=("mp4"))
78
  if input_file is not None:
79
  # νŒŒμΌμ„ μž„μ‹œ κ²½λ‘œμ— μ €μž₯
80
  g = io.BytesIO(input_file.read())
 
9
  from camera_input_live import camera_input_live
10
 
11
  st.set_page_config(
12
+ page_title="κΈ€μž 인식 AI μ‹œμŠ€ν…œ",
13
  page_icon=":sun_with_face:",
14
  layout="centered",
15
  initial_sidebar_state="expanded",)
16
 
17
+ st.title("κΈ€μž 인식 AI μ‹œμŠ€ν…œ :sun_with_face:")
18
 
19
+ st.sidebar.header("메뉴")
20
+ source_radio = st.sidebar.radio("μ„ νƒν•˜μ„Έμš”", ["IMAGE", "VIDEO", "WEBCAM"])
21
 
22
+ st.sidebar.header("신뒰도")
23
+ conf_threshold = float(st.sidebar.slider("신뒰도 μž„κ³„κ°’μ„ μ„ νƒν•˜μ„Έμš”", 10, 100, 20))/100
24
 
25
  input = None
26
  if source_radio == "IMAGE":
27
+ st.sidebar.header("이미지 파일 μ—…λ‘œλ“œ")
28
+ input = st.sidebar.file_uploader("이미지 νŒŒμΌμ„ μ„ νƒν•˜μ„Έμš”", type=("jpg", "png"))
29
  if input is not None:
30
  uploaded_image = Image.open(input)
31
  uploaded_image_cv = cv2.cvtColor(np.array(uploaded_image), cv2.COLOR_RGB2BGR)
 
55
  visualized_image = utils.convert_result_to_image(frame, resized_image, boxes, conf_labels=False)
56
  except:
57
  visualized_image = frame
58
+ st_frameμš”", type=("mp4"))
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
59
  if input_file is not None:
60
  # νŒŒμΌμ„ μž„μ‹œ κ²½λ‘œμ— μ €μž₯
61
  g = io.BytesIO(input_file.read())