Spaces:
Sleeping
Sleeping
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() |