Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -26,22 +26,22 @@ except Exception as e:
|
|
26 |
st.error(f"An error occurred: {e}")
|
27 |
|
28 |
|
29 |
-
def copy(text):
|
30 |
-
|
31 |
-
|
32 |
|
33 |
-
|
34 |
-
|
35 |
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
|
46 |
|
47 |
# Streamlit app
|
@@ -126,18 +126,18 @@ def main():
|
|
126 |
elif chat["role"] == "bot":
|
127 |
st.markdown(chat["content"])
|
128 |
col1 = st.columns(10)
|
129 |
-
with col1[0]:
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
# Add a speak button in the second column
|
135 |
-
with col1[1]:
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
|
142 |
|
143 |
|
|
|
26 |
st.error(f"An error occurred: {e}")
|
27 |
|
28 |
|
29 |
+
# def copy(text):
|
30 |
+
# """
|
31 |
+
# Copy text to clipboard on Windows.
|
32 |
|
33 |
+
# Parameters:
|
34 |
+
# text (str): The text to copy to the clipboard.
|
35 |
|
36 |
+
# Returns:
|
37 |
+
# bool: True if the text was successfully copied, False otherwise.
|
38 |
+
# """
|
39 |
+
# try:
|
40 |
+
# subprocess.run(['clip'], input=text.strip().encode('utf-16'), check=True)
|
41 |
+
# return True
|
42 |
+
# except subprocess.CalledProcessError:
|
43 |
+
# st.error("Error: Unable to copy text to clipboard on Windows.")
|
44 |
+
# return False
|
45 |
|
46 |
|
47 |
# Streamlit app
|
|
|
126 |
elif chat["role"] == "bot":
|
127 |
st.markdown(chat["content"])
|
128 |
col1 = st.columns(10)
|
129 |
+
# with col1[0]:
|
130 |
+
# copy_button = f"text_copy_{index}"
|
131 |
+
# if st.button('π', key=copy_button):
|
132 |
+
# copy(chat["content"]) # Assuming chat["content"] contains the text to copy
|
133 |
+
|
134 |
+
# # Add a speak button in the second column
|
135 |
+
# with col1[1]:
|
136 |
+
# speak_button = f"text_regenerate_{index}"
|
137 |
+
# if st.button('π', key=speak_button):
|
138 |
+
# engine = pyttsx3.init()
|
139 |
+
# engine.say(chat["content"])
|
140 |
+
# engine.runAndWait()
|
141 |
|
142 |
|
143 |
|