mharkey commited on
Commit
cba37a7
Β·
verified Β·
1 Parent(s): 9023bfb

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -8
app.py CHANGED
@@ -2,16 +2,15 @@ import gradio as gr
2
  from transformers import pipeline
3
  from datasets import load_dataset
4
 
5
- # Choose your model here – change if needed
6
- model_name = "Qwen/Qwen1.5-7B-Chat"
7
 
8
- # Load the text generation pipeline
9
  pipe = pipeline("text-generation", model=model_name, device=0)
10
 
11
- # Load GTA dataset (optional)
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 Hugging Face Models")
31
- gr.Markdown("Enter a question or choose a sample from the GTA benchmark.")
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()