Update app.py
Browse files
app.py
CHANGED
@@ -116,21 +116,6 @@ def get_stock(product_code):
|
|
116 |
xml_data = response.content
|
117 |
data = xmltodict.parse(xml_data)
|
118 |
|
119 |
-
for product in data['products']:
|
120 |
-
if product['code'] == product_code:
|
121 |
-
stok_kod = product['code']
|
122 |
-
urun_ad = product['name']
|
123 |
-
satis_fiyat = product['price']
|
124 |
-
varyant = product['variant']
|
125 |
-
stok = int(product['quantity'])
|
126 |
-
return f"Ürün Kodu: {stok_kod}\nÜrün Adı: {urun_ad}\nSatış Fiyatı: {satis_fiyat}\nVaryant: {varyant}\nStok: {stok}"
|
127 |
-
|
128 |
-
return "Ürün bulunamadı."
|
129 |
-
else:
|
130 |
-
return "API'ye bağlanırken hata oluştu."
|
131 |
-
|
132 |
-
iface = gr.Interface(fn=get_stock, inputs=["text"], outputs="text", title="Stok Sorgulama Chatbotu", description="Ürün kodunu girin ve stok bilgisini alın.")
|
133 |
-
iface.launch()
|
134 |
import xml.etree.ElementTree as ET
|
135 |
|
136 |
xml_data = """<?xml version="1.0" encoding="UTF-8"?>
|
|
|
116 |
xml_data = response.content
|
117 |
data = xmltodict.parse(xml_data)
|
118 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
119 |
import xml.etree.ElementTree as ET
|
120 |
|
121 |
xml_data = """<?xml version="1.0" encoding="UTF-8"?>
|