dortislem / app.py
arzubesiroglu's picture
Create app.py
13a26cd verified
import gradio as gr
# Fonksiyonlar
def topla(a, b):
return a + b
def cikar(a, b):
return a - b
def carp(a, b):
return a * b
def bol(a, b):
if b == 0:
return "Sıfıra bölünemez!"
return a / b
# Toplama sekmesi
toplama = gr.Interface(
fn=topla,
inputs=[gr.Number(label="Sayı 1"), gr.Number(label="Sayı 2")],
outputs=gr.Number(label="Sonuç"),
title="Toplama"
)
# Çıkarma sekmesi
cikarma = gr.Interface(
fn=cikar,
inputs=[gr.Number(label="Sayı 1"), gr.Number(label="Sayı 2")],
outputs=gr.Number(label="Sonuç"),
title="Çıkarma"
)
# Çarpma sekmesi
carpma = gr.Interface(
fn=carp,
inputs=[gr.Number(label="Sayı 1"), gr.Number(label="Sayı 2")],
outputs=gr.Number(label="Sonuç"),
title="Çarpma"
)
# Bölme sekmesi
bolme = gr.Interface(
fn=bol,
inputs=[gr.Number(label="Sayı 1"), gr.Number(label="Sayı 2")],
outputs=gr.Textbox(label="Sonuç"),
title="Bölme"
)
# Tüm sekmeleri birleştir
app = gr.TabbedInterface(
[toplama, cikarma, carpma, bolme],
["Toplama", "Çıkarma", "Çarpma", "Bölme"]
)
if __name__ == "__main__":
app.launch()