GarGerry commited on
Commit
f1b58dc
·
verified ·
1 Parent(s): 2c53c35

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -5
app.py CHANGED
@@ -1,7 +1,7 @@
1
  import streamlit as st
2
  import pandas as pd
3
  import matplotlib.pyplot as plt
4
- from transformers import pipeline, Conversation
5
 
6
  def main():
7
  st.title("Financial Budget Planner 💰")
@@ -47,18 +47,17 @@ def main():
47
  # Chatbot Keuangan
48
  st.subheader("Chatbot Keuangan 🤖")
49
  st.write("Tanyakan apa saja tentang keuangan!")
50
- chatbot = pipeline("conversational", model="facebook/blenderbot-3B") # Model lebih besar & responsif
51
  user_question = st.text_input("Masukkan pertanyaan finansial Anda:")
52
 
53
  if st.button("Tanyakan"):
54
  if user_question:
55
- conversation = Conversation(user_question)
56
- response = chatbot(conversation).generated_responses[-1]
57
  st.write("💬 Chatbot:", response)
58
 
59
  if __name__ == "__main__":
60
  main()
61
 
62
 
63
- #Saya telah mengganti model chatbot ke "facebook/blenderbot-3B", yang lebih besar dan lebih responsif dalam menjawab pertanyaan keuangan. Coba jalankan lagi dan beri tahu apakah chatbot sudah lebih baik!
64
 
 
1
  import streamlit as st
2
  import pandas as pd
3
  import matplotlib.pyplot as plt
4
+ from transformers import pipeline
5
 
6
  def main():
7
  st.title("Financial Budget Planner 💰")
 
47
  # Chatbot Keuangan
48
  st.subheader("Chatbot Keuangan 🤖")
49
  st.write("Tanyakan apa saja tentang keuangan!")
50
+ chatbot = pipeline("text2text-generation", model="google/flan-t5-large") # Model lebih akurat
51
  user_question = st.text_input("Masukkan pertanyaan finansial Anda:")
52
 
53
  if st.button("Tanyakan"):
54
  if user_question:
55
+ response = chatbot(user_question, max_length=100)[0]["generated_text"]
 
56
  st.write("💬 Chatbot:", response)
57
 
58
  if __name__ == "__main__":
59
  main()
60
 
61
 
62
+ #Saya telah mengganti model chatbot ke "google/flan-t5-large", yang lebih fleksibel dan bisa menjawab pertanyaan keuangan dengan lebih baik. Silakan coba jalankan kembali dan lihat apakah responsnya lebih baik!
63