Set custom name for the csv file
Browse files
app.py
CHANGED
|
@@ -11,6 +11,7 @@ import gradio as gr
|
|
| 11 |
import tempfile
|
| 12 |
import re
|
| 13 |
import ast
|
|
|
|
| 14 |
|
| 15 |
#for adding bank name to the cards in the graph
|
| 16 |
eligibility_df = pd.read_csv("cards_eligibility_updated.csv")
|
|
@@ -716,10 +717,13 @@ def recommend_cards_gradio(user_query, preferences, income, cibil, age,
|
|
| 716 |
"""
|
| 717 |
|
| 718 |
df_cards = pd.DataFrame(card_rows, columns=["Card Name", "Matched Features", "Description"])
|
| 719 |
-
|
| 720 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 721 |
|
| 722 |
-
return top_card_html, card_rows, temp_file.name, card_names, card_lookup, direct_query
|
| 723 |
|
| 724 |
except Exception as e:
|
| 725 |
print("Error:", e)
|
|
@@ -935,6 +939,5 @@ with gr.Blocks() as demo:
|
|
| 935 |
inputs=[query,user_query_for_chat, chat_history, card_lookup_state],
|
| 936 |
outputs=[chatbot, chat_history]
|
| 937 |
)
|
| 938 |
-
|
| 939 |
-
|
| 940 |
demo.launch(share=True)
|
|
|
|
| 11 |
import tempfile
|
| 12 |
import re
|
| 13 |
import ast
|
| 14 |
+
import os
|
| 15 |
|
| 16 |
#for adding bank name to the cards in the graph
|
| 17 |
eligibility_df = pd.read_csv("cards_eligibility_updated.csv")
|
|
|
|
| 717 |
"""
|
| 718 |
|
| 719 |
df_cards = pd.DataFrame(card_rows, columns=["Card Name", "Matched Features", "Description"])
|
| 720 |
+
filename = "recommended_cards.csv"
|
| 721 |
+
temp_dir = tempfile.gettempdir()
|
| 722 |
+
file_path = os.path.join(temp_dir, filename)
|
| 723 |
+
df_cards.to_csv(file_path, index=False)
|
| 724 |
+
|
| 725 |
+
return top_card_html, card_rows, file_path, card_names, card_lookup, direct_query
|
| 726 |
|
|
|
|
| 727 |
|
| 728 |
except Exception as e:
|
| 729 |
print("Error:", e)
|
|
|
|
| 939 |
inputs=[query,user_query_for_chat, chat_history, card_lookup_state],
|
| 940 |
outputs=[chatbot, chat_history]
|
| 941 |
)
|
| 942 |
+
|
|
|
|
| 943 |
demo.launch(share=True)
|