yagnik12 commited on
Commit
061d6b5
Β·
verified Β·
1 Parent(s): ee5337c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -8
app.py CHANGED
@@ -8,28 +8,32 @@ with gr.Blocks(theme=gr.themes.Soft()) as demo:
8
  gr.Markdown(
9
  """
10
  # πŸ€– AI vs Human Text Detector
11
-
12
  Paste any text below. Our system will analyze it using **three advanced models** to detect if the text is AI-generated or human-written.
13
-
14
  ### πŸ“ Formatting Preservation
15
-
16
  - Your **line breaks, spacing, and Markdown syntax** will be preserved exactly as you paste them.
17
  - The input and output text are displayed without any modification.
18
  - Perfect for analyzing **code snippets, poetry, or Markdown documents** without losing formatting.
19
-
20
  Click **"πŸš€ Run Detection"** to start.
21
  """
22
  )
23
 
24
  with gr.Row():
25
  with gr.Column(scale=1):
26
- formatted_input_display = gr.Code(label="πŸ“ Your Input (Preserved Formatting)", interactive=False)
 
 
 
 
 
 
27
 
28
  with gr.Column(scale=2):
 
29
  user_input = gr.Textbox(
30
  label="✍️ Enter Text",
31
  placeholder="Paste text here...",
32
- lines=10
 
33
  )
34
  analyze_btn = gr.Button("πŸš€ Run Detection", variant="primary")
35
 
@@ -41,7 +45,8 @@ with gr.Blocks(theme=gr.themes.Soft()) as demo:
41
 
42
  def run_analysis(user_text):
43
  results = analyze_text(user_text)
44
- return results, results, user_text # send input text as-is to output
 
45
 
46
  analyze_btn.click(
47
  fn=run_analysis,
@@ -49,4 +54,4 @@ with gr.Blocks(theme=gr.themes.Soft()) as demo:
49
  outputs=[final_output, model_output, formatted_input_display]
50
  )
51
 
52
- demo.launch()
 
8
  gr.Markdown(
9
  """
10
  # πŸ€– AI vs Human Text Detector
 
11
  Paste any text below. Our system will analyze it using **three advanced models** to detect if the text is AI-generated or human-written.
 
12
  ### πŸ“ Formatting Preservation
 
13
  - Your **line breaks, spacing, and Markdown syntax** will be preserved exactly as you paste them.
14
  - The input and output text are displayed without any modification.
15
  - Perfect for analyzing **code snippets, poetry, or Markdown documents** without losing formatting.
 
16
  Click **"πŸš€ Run Detection"** to start.
17
  """
18
  )
19
 
20
  with gr.Row():
21
  with gr.Column(scale=1):
22
+ # βœ… Read-only textbox to display exactly what user pasted
23
+ formatted_input_display = gr.Textbox(
24
+ label="πŸ“ Your Input (Preserved Formatting)",
25
+ interactive=False,
26
+ lines=20,
27
+ show_copy_button=True
28
+ )
29
 
30
  with gr.Column(scale=2):
31
+ # βœ… Input also preserves formatting (raw text, multi-line)
32
  user_input = gr.Textbox(
33
  label="✍️ Enter Text",
34
  placeholder="Paste text here...",
35
+ lines=12,
36
+ type="text" # important: raw text mode (not value/number)
37
  )
38
  analyze_btn = gr.Button("πŸš€ Run Detection", variant="primary")
39
 
 
45
 
46
  def run_analysis(user_text):
47
  results = analyze_text(user_text)
48
+ # return results + original raw input
49
+ return results, results, user_text
50
 
51
  analyze_btn.click(
52
  fn=run_analysis,
 
54
  outputs=[final_output, model_output, formatted_input_display]
55
  )
56
 
57
+ demo.launch()