krish10 commited on
Commit
2f54331
·
verified ·
1 Parent(s): 6617bf4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -14
app.py CHANGED
@@ -16,16 +16,14 @@ TEMPERATURE = 0.1
16
  TOP_P = 0.9
17
 
18
  @spaces.GPU
19
- def respond_stream(summary, title, abstract):
20
- # Validate mandatory fields
21
- if not summary.strip() or not title.strip() or not abstract.strip():
22
- return "❌ Error: PICOS Summary, Title, and Abstract are all required."
23
 
24
- # Build prompt
25
  prompt = (
26
- f"Instruction: Use the following PICOS summary to evaluate the abstract.\n"
27
- f"\nPICOS Summary: {summary.strip()}"
28
- f"\n\nTitle: {title.strip()}\nAbstract: {abstract.strip()}"
29
  )
30
 
31
  # Wrap into message for chat template
@@ -56,22 +54,20 @@ def respond_stream(summary, title, abstract):
56
 
57
  # Build Gradio interface
58
  with gr.Blocks() as demo:
59
- gr.Markdown("## 🤖 Qwen Streaming Chat — Abstract Evaluation with PICOS Summary")
60
 
61
  with gr.Column():
62
- summary = gr.Textbox(label="PICOS Summary", lines=4, placeholder="Required")
63
- title = gr.Textbox(label="Title", lines=2, placeholder="Required")
64
- abstract = gr.Textbox(label="Abstract", lines=10, placeholder="Required")
65
 
66
  output_box = gr.Textbox(label="Model Response", lines=15, interactive=False)
67
  generate_btn = gr.Button("Generate")
68
 
69
  generate_btn.click(
70
  fn=respond_stream,
71
- inputs=[summary, title, abstract],
72
  outputs=[output_box]
73
  )
74
 
75
  # Launch the app
76
  if __name__ == "__main__":
77
- demo.launch()
 
16
  TOP_P = 0.9
17
 
18
  @spaces.GPU
19
+ def respond_stream(user_input):
20
+ # Validate input
21
+ if not user_input.strip():
22
+ return "❌ Error: Input text is required."
23
 
24
+ # Use the entire input directly in the prompt
25
  prompt = (
26
+ f"Instruction: \n\n{user_input.strip()}"
 
 
27
  )
28
 
29
  # Wrap into message for chat template
 
54
 
55
  # Build Gradio interface
56
  with gr.Blocks() as demo:
57
+ gr.Markdown("## 🤖 Qwen Streaming Chat — Abstract Evaluation")
58
 
59
  with gr.Column():
60
+ user_input = gr.Textbox(label="Input Text", lines=15, placeholder="Paste your full input here (PICOS + Title + Abstract)...")
 
 
61
 
62
  output_box = gr.Textbox(label="Model Response", lines=15, interactive=False)
63
  generate_btn = gr.Button("Generate")
64
 
65
  generate_btn.click(
66
  fn=respond_stream,
67
+ inputs=[user_input],
68
  outputs=[output_box]
69
  )
70
 
71
  # Launch the app
72
  if __name__ == "__main__":
73
+ demo.launch()