Spaces:
No application file
No application file
Commit
•
fa4564e
1
Parent(s):
512cbf9
Update app.Py
Browse files
app.Py
CHANGED
@@ -1,7 +1,5 @@
|
|
1 |
import gradio as gr
|
2 |
from transformers import pipeline
|
3 |
-
|
4 |
-
# Load the calculator model from Hugging Face
|
5 |
calculator = pipeline("zero-shot-classification")
|
6 |
|
7 |
def calculate_expression(expression):
|
@@ -14,7 +12,3 @@ def calculate_expression(expression):
|
|
14 |
return eval(expression)
|
15 |
elif result["labels"][0] == "division":
|
16 |
return eval(expression)
|
17 |
-
inputs = gr.inputs.Textbox(lines=1, label="Enter an arithmetic expression")
|
18 |
-
outputs = gr.outputs.Textbox(label="Result")
|
19 |
-
interface = gr.Interface(fn=calculate_expression, inputs=inputs, outputs=outputs, title="Calculator")
|
20 |
-
interface.launch()
|
|
|
1 |
import gradio as gr
|
2 |
from transformers import pipeline
|
|
|
|
|
3 |
calculator = pipeline("zero-shot-classification")
|
4 |
|
5 |
def calculate_expression(expression):
|
|
|
12 |
return eval(expression)
|
13 |
elif result["labels"][0] == "division":
|
14 |
return eval(expression)
|
|
|
|
|
|
|
|