store_example / app.py
cdactvm's picture
Update app.py
446ddfb verified
raw
history blame
No virus
891 Bytes
import os
import gradio as gr
HF_TOKEN = os.getenv('HW_TOKEN')
#print (HF_TOKEN)
hf_writer = gr.HuggingFaceDatasetSaver(HF_TOKEN, "save_audio")
def calculator(num1, operation, num2):
if operation == "add":
return num1 + num2
elif operation == "subtract":
return num1 - num2
elif operation == "multiply":
return num1 * num2
elif operation == "divide":
return num1 / num2
iface = gr.Interface(
calculator,
["number", gr.Radio(["add", "subtract", "multiply", "divide"]), "number"],
"number",
#description="Check out the crowd-sourced dataset at: [https://huggingface.co/datasets/aliabd/crowdsourced-calculator-demo](https://huggingface.co/datasets/aliabd/crowdsourced-calculator-demo)",
allow_flagging="manual",
flagging_options=["wrong sign", "off by one", "other"],
flagging_callback=hf_writer
)
iface.launch()