Spaces:
Sleeping
Sleeping
File size: 1,162 Bytes
13a26cd |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
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()
|