AhmedEwis commited on
Commit
2ededac
·
1 Parent(s): 2d06113

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -14
app.py CHANGED
@@ -63,21 +63,13 @@ def is_query_about_cashback(query):
63
  return any(word.lower() in query.lower() for word in cashback_keywords)
64
 
65
  def ask_ai(query):
66
- if is_query_about_cashback(query):
67
- # Extract the required information from the query or ask the user for more information if needed
68
- segment = input("Enter your card segment: ")
69
- total_spent = float(input("Enter your total spent amount: "))
70
- international_transactions = float(input("Enter your international transactions amount: "))
71
- local_transactions = float(input("Enter your local transactions amount: "))
72
-
73
- cashback = cashback_calculator(segment, total_spent, international_transactions, local_transactions)
74
- return f"The cashback amount for your card is: {cashback:.2f}"
75
- else:
76
- index = GPTSimpleVectorIndex.load_from_disk('index.json')
77
- response = index.query(query, response_mode="compact")
78
- return response.response
79
- iface = gr.Interface(fn=ask_ai, inputs=["text", "text", "number", "number", "number"], outputs="text", title="The following is a conversation with a human called Shegardi. Shegardi is helpful, precise, truthful, and very friendly. Also, Shegardi is an employee of Warba Bank, located in Kuwait. Shegardi will only use the information provided to him.",
80
  description="Enter a question and get an answer from Shegardi.")
 
81
  iface.launch()
82
 
83
 
 
63
  return any(word.lower() in query.lower() for word in cashback_keywords)
64
 
65
  def ask_ai(query):
66
+ index = GPTSimpleVectorIndex.load_from_disk('index.json')
67
+ response = index.query(query, response_mode="compact")
68
+ return response.response
69
+
70
+ iface = gr.Interface(fn=ask_ai, inputs="text", outputs="text", title="The following is a conversation with a human called Shegardi. Shegardi is helpful, precise, truthful, and very friendly. Also, Shegardi is an employee of Warba Bank, located in Kuwait. Shegardi will only use the information provided to him. ",
 
 
 
 
 
 
 
 
 
71
  description="Enter a question and get an answer from Shegardi.")
72
+
73
  iface.launch()
74
 
75