Mohzen321 commited on
Commit
902d69b
·
verified ·
1 Parent(s): 7b66490

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +21 -10
app.py CHANGED
@@ -66,14 +66,10 @@ if uploaded_file is not None:
66
 
67
  # دالة تحديث النتائج
68
  def update_results():
69
- st.header("Shopping Keywords")
70
- st.text_area("Copy the shopping keywords here:", value="\n".join(shopping_words), height=200, key="shopping")
71
-
72
- st.header("Gaming Keywords")
73
- st.text_area("Copy the gaming keywords here:", value="\n".join(gaming_words), height=200, key="gaming")
74
-
75
- st.header("Streaming Keywords")
76
- st.text_area("Copy the streaming keywords here:", value="\n".join(streaming_words), height=200, key="streaming")
77
 
78
  # زر البدء
79
  if st.button("Start"):
@@ -94,6 +90,21 @@ if uploaded_file is not None:
94
  stopped = True
95
  st.write("Classification stopped.")
96
 
97
- else:
98
- st.warning("Please upload a text file to classify the keywords.")
 
 
 
99
 
 
 
 
 
 
 
 
 
 
 
 
 
 
66
 
67
  # دالة تحديث النتائج
68
  def update_results():
69
+ # تحديث محتوى المربعات النصية مباشرةً دون إعادة إنشائها
70
+ st.session_state.shopping_text = "\n".join(shopping_words)
71
+ st.session_state.gaming_text = "\n".join(gaming_words)
72
+ st.session_state.streaming_text = "\n".join(streaming_words)
 
 
 
 
73
 
74
  # زر البدء
75
  if st.button("Start"):
 
90
  stopped = True
91
  st.write("Classification stopped.")
92
 
93
+ # عرض النتائج مرة واحدة فقط (بدون إعادة إنشاء العناصر)
94
+ st.header("Shopping Keywords")
95
+ if 'shopping_text' not in st.session_state:
96
+ st.session_state.shopping_text = ""
97
+ st.text_area("Copy the shopping keywords here:", value=st.session_state.shopping_text, height=200, key="shopping")
98
 
99
+ st.header("Gaming Keywords")
100
+ if 'gaming_text' not in st.session_state:
101
+ st.session_state.gaming_text = ""
102
+ st.text_area("Copy the gaming keywords here:", value=st.session_state.gaming_text, height=200, key="gaming")
103
+
104
+ st.header("Streaming Keywords")
105
+ if 'streaming_text' not in st.session_state:
106
+ st.session_state.streaming_text = ""
107
+ st.text_area("Copy the streaming keywords here:", value=st.session_state.streaming_text, height=200, key="streaming")
108
+
109
+ else:
110
+ st.warning("Please upload a text file to classify the keywords.")