Update app.py
Browse files
app.py
CHANGED
|
@@ -2,16 +2,15 @@ import gradio as gr
|
|
| 2 |
from transformers import pipeline
|
| 3 |
from datasets import load_dataset
|
| 4 |
|
| 5 |
-
#
|
| 6 |
-
model_name = "Qwen/
|
| 7 |
|
| 8 |
-
# Load
|
| 9 |
pipe = pipeline("text-generation", model=model_name, device=0)
|
| 10 |
|
| 11 |
-
# Load GTA
|
| 12 |
gta_data = load_dataset("open-compass/GTA", split="test")
|
| 13 |
|
| 14 |
-
# Inference function
|
| 15 |
def run_model(input_text, use_gta_index):
|
| 16 |
if use_gta_index:
|
| 17 |
try:
|
|
@@ -27,8 +26,8 @@ def run_model(input_text, use_gta_index):
|
|
| 27 |
|
| 28 |
# Gradio UI
|
| 29 |
with gr.Blocks() as demo:
|
| 30 |
-
gr.Markdown("# 🤖 GTA-style Reasoning with
|
| 31 |
-
gr.Markdown("
|
| 32 |
with gr.Row():
|
| 33 |
input_text = gr.Textbox(label="Enter a question or GTA index (e.g., 0–228)")
|
| 34 |
use_sample = gr.Checkbox(label="Use as GTA index", value=False)
|
|
@@ -37,4 +36,4 @@ with gr.Blocks() as demo:
|
|
| 37 |
|
| 38 |
run_button.click(run_model, inputs=[input_text, use_sample], outputs=output_text)
|
| 39 |
|
| 40 |
-
demo.launch()
|
|
|
|
| 2 |
from transformers import pipeline
|
| 3 |
from datasets import load_dataset
|
| 4 |
|
| 5 |
+
# ✅ Use smaller, memory-friendly model
|
| 6 |
+
model_name = "Qwen/Qwen2.5-3B"
|
| 7 |
|
| 8 |
+
# Load model pipeline
|
| 9 |
pipe = pipeline("text-generation", model=model_name, device=0)
|
| 10 |
|
| 11 |
+
# Load GTA benchmark (optional)
|
| 12 |
gta_data = load_dataset("open-compass/GTA", split="test")
|
| 13 |
|
|
|
|
| 14 |
def run_model(input_text, use_gta_index):
|
| 15 |
if use_gta_index:
|
| 16 |
try:
|
|
|
|
| 26 |
|
| 27 |
# Gradio UI
|
| 28 |
with gr.Blocks() as demo:
|
| 29 |
+
gr.Markdown("# 🤖 GTA-style Reasoning with Qwen 2.5-3B")
|
| 30 |
+
gr.Markdown("Test queries from the GTA benchmark or enter your own.")
|
| 31 |
with gr.Row():
|
| 32 |
input_text = gr.Textbox(label="Enter a question or GTA index (e.g., 0–228)")
|
| 33 |
use_sample = gr.Checkbox(label="Use as GTA index", value=False)
|
|
|
|
| 36 |
|
| 37 |
run_button.click(run_model, inputs=[input_text, use_sample], outputs=output_text)
|
| 38 |
|
| 39 |
+
demo.launch()
|