Spaces:
Runtime error
Runtime error
Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
from transformers import pipeline
|
| 3 |
+
|
| 4 |
+
# Load the model
|
| 5 |
+
pipe = pipeline("text-classification", model="Qwen/Qwen2.5-Math-PRM-72B", trust_remote_code=True)
|
| 6 |
+
|
| 7 |
+
# Define a function to generate responses
|
| 8 |
+
def generate_response(prompt):
|
| 9 |
+
output = pipe(prompt)
|
| 10 |
+
return output[0]['label']
|
| 11 |
+
|
| 12 |
+
# Create a Gradio interface
|
| 13 |
+
iface = gr.Interface(
|
| 14 |
+
fn=generate_response,
|
| 15 |
+
inputs="text",
|
| 16 |
+
outputs="text",
|
| 17 |
+
title="Qwen2.5 Math Model",
|
| 18 |
+
description="Ask a math question and get an answer!"
|
| 19 |
+
)
|
| 20 |
+
|
| 21 |
+
# Launch the interface
|
| 22 |
+
iface.launch()
|