Spaces:
Sleeping
Sleeping
Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
|
| 3 |
+
# Fonksiyonlar
|
| 4 |
+
def topla(a, b):
|
| 5 |
+
return a + b
|
| 6 |
+
|
| 7 |
+
def cikar(a, b):
|
| 8 |
+
return a - b
|
| 9 |
+
|
| 10 |
+
def carp(a, b):
|
| 11 |
+
return a * b
|
| 12 |
+
|
| 13 |
+
def bol(a, b):
|
| 14 |
+
if b == 0:
|
| 15 |
+
return "Sıfıra bölünemez!"
|
| 16 |
+
return a / b
|
| 17 |
+
|
| 18 |
+
# Toplama sekmesi
|
| 19 |
+
toplama = gr.Interface(
|
| 20 |
+
fn=topla,
|
| 21 |
+
inputs=[gr.Number(label="Sayı 1"), gr.Number(label="Sayı 2")],
|
| 22 |
+
outputs=gr.Number(label="Sonuç"),
|
| 23 |
+
title="Toplama"
|
| 24 |
+
)
|
| 25 |
+
|
| 26 |
+
# Çıkarma sekmesi
|
| 27 |
+
cikarma = gr.Interface(
|
| 28 |
+
fn=cikar,
|
| 29 |
+
inputs=[gr.Number(label="Sayı 1"), gr.Number(label="Sayı 2")],
|
| 30 |
+
outputs=gr.Number(label="Sonuç"),
|
| 31 |
+
title="Çıkarma"
|
| 32 |
+
)
|
| 33 |
+
|
| 34 |
+
# Çarpma sekmesi
|
| 35 |
+
carpma = gr.Interface(
|
| 36 |
+
fn=carp,
|
| 37 |
+
inputs=[gr.Number(label="Sayı 1"), gr.Number(label="Sayı 2")],
|
| 38 |
+
outputs=gr.Number(label="Sonuç"),
|
| 39 |
+
title="Çarpma"
|
| 40 |
+
)
|
| 41 |
+
|
| 42 |
+
# Bölme sekmesi
|
| 43 |
+
bolme = gr.Interface(
|
| 44 |
+
fn=bol,
|
| 45 |
+
inputs=[gr.Number(label="Sayı 1"), gr.Number(label="Sayı 2")],
|
| 46 |
+
outputs=gr.Textbox(label="Sonuç"),
|
| 47 |
+
title="Bölme"
|
| 48 |
+
)
|
| 49 |
+
|
| 50 |
+
# Tüm sekmeleri birleştir
|
| 51 |
+
app = gr.TabbedInterface(
|
| 52 |
+
[toplama, cikarma, carpma, bolme],
|
| 53 |
+
["Toplama", "Çıkarma", "Çarpma", "Bölme"]
|
| 54 |
+
)
|
| 55 |
+
|
| 56 |
+
if __name__ == "__main__":
|
| 57 |
+
app.launch()
|