File size: 544 Bytes
74de6d6
a20dfe9
 
 
 
fdb9c67
a20dfe9
 
74de6d6
a20dfe9
74de6d6
a20dfe9
 
 
 
 
74de6d6
a20dfe9
958f56e
fdb9c67
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import gradio as gr
from transformers import pipeline
def generate_response(text):
  # Load the Qwen2-Math pipeline
  pipe = pipeline("text-generation", model="qwen2-math-72b-instruct")

  # Generate the response
  response = pipe(text, max_length=512)[0]['generated_text']

  return response

with gr.Blocks() as demo:
  gr.Markdown("## Math Reasoning Chatbot")
  txt = gr.Textbox(label="Enter your math problem")
  btn = gr.Button("Submit")
  output = gr.Textbox()

  btn.click(fn=generate_response, inputs=txt, outputs=output)

demo.launch()