mimbres commited on
Commit
4a3ead8
โ€ข
1 Parent(s): 8e9bd69

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +18 -13
app.py CHANGED
@@ -5,28 +5,33 @@ def process_file(file_obj):
5
  if file_obj is None:
6
  return "No file uploaded."
7
 
 
8
  save_path = os.path.join(os.getcwd(), file_obj.name)
9
  with open(save_path, "wb") as f:
10
  f.write(file_obj.read())
 
 
11
  return save_path
12
 
13
  def process_text(text):
 
14
  return text
15
 
16
  with gr.Blocks() as demo:
17
- with gr.Row():
18
- file_input = gr.File(label="Drag & Drop File Here")
19
- submit_file_button = gr.Button("Submit File")
20
-
21
- file_output = gr.Text(label="File Path")
22
-
23
- with gr.Row():
24
- text_input = gr.Textbox(label="Enter Text Here")
25
- submit_text_button = gr.Button("Submit Text")
26
 
27
- text_output = gr.Text(label="Processed Text")
28
-
29
- submit_file_button.click(process_file, inputs=file_input, outputs=file_output)
30
- submit_text_button.click(process_text, inputs=text_input, outputs=text_output)
 
 
 
31
 
32
  demo.launch()
 
5
  if file_obj is None:
6
  return "No file uploaded."
7
 
8
+ # ํŒŒ์ผ ์ €์žฅํ•˜๊ธฐ
9
  save_path = os.path.join(os.getcwd(), file_obj.name)
10
  with open(save_path, "wb") as f:
11
  f.write(file_obj.read())
12
+
13
+ # ์ ˆ๋Œ€ ๊ฒฝ๋กœ ๋ฐ˜ํ™˜
14
  return save_path
15
 
16
  def process_text(text):
17
+ # ์ž…๋ ฅ๋œ ํ…์ŠคํŠธ๋ฅผ ๊ทธ๋Œ€๋กœ ๋ฐ˜ํ™˜
18
  return text
19
 
20
  with gr.Blocks() as demo:
21
+ # ํ…์ŠคํŠธ ์ž…๋ ฅ ๋ฐ ์ถœ๋ ฅ ๋ธ”๋ก
22
+ with gr.Group():
23
+ with gr.Row():
24
+ text_input = gr.Textbox(label="Enter Text Here")
25
+ submit_text_button = gr.Button("Submit Text")
26
+ text_output = gr.Text(label="Processed Text")
27
+ submit_text_button.click(process_text, inputs=text_input, outputs=text_output)
 
 
28
 
29
+ # ํŒŒ์ผ ์ž…๋ ฅ ๋ฐ ๊ฒฝ๋กœ ์ถœ๋ ฅ ๋ธ”๋ก
30
+ with gr.Group():
31
+ with gr.Row():
32
+ file_input = gr.File(label="Drag & Drop File Here")
33
+ submit_file_button = gr.Button("Submit File")
34
+ file_output = gr.Text(label="File Path")
35
+ submit_file_button.click(process_file, inputs=file_input, outputs=file_output)
36
 
37
  demo.launch()