Update app.py
Browse files
app.py
CHANGED
|
@@ -16,16 +16,14 @@ TEMPERATURE = 0.1
|
|
| 16 |
TOP_P = 0.9
|
| 17 |
|
| 18 |
@spaces.GPU
|
| 19 |
-
def respond_stream(
|
| 20 |
-
# Validate
|
| 21 |
-
if not
|
| 22 |
-
return "❌ Error:
|
| 23 |
|
| 24 |
-
#
|
| 25 |
prompt = (
|
| 26 |
-
f"Instruction:
|
| 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
|
| 60 |
|
| 61 |
with gr.Column():
|
| 62 |
-
|
| 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=[
|
| 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()
|