Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -57,6 +57,10 @@ def conversational_chat(query, replacement_word=None):
|
|
57 |
output = re.sub(r'\bjack\b', replacement_word, output, flags=re.IGNORECASE)
|
58 |
|
59 |
return extract_text_from_html(output)
|
|
|
|
|
|
|
|
|
60 |
|
61 |
|
62 |
|
@@ -126,6 +130,10 @@ def ui():
|
|
126 |
if st.button("Submit"):
|
127 |
# Generate a chatbot response
|
128 |
bio = conversational_chat(prompt, name_input)
|
|
|
|
|
|
|
|
|
129 |
st.write(bio)
|
130 |
|
131 |
|
|
|
57 |
output = re.sub(r'\bjack\b', replacement_word, output, flags=re.IGNORECASE)
|
58 |
|
59 |
return extract_text_from_html(output)
|
60 |
+
|
61 |
+
def word_count(text):
|
62 |
+
words = re.findall(r'\w+', text)
|
63 |
+
return len(words)
|
64 |
|
65 |
|
66 |
|
|
|
130 |
if st.button("Submit"):
|
131 |
# Generate a chatbot response
|
132 |
bio = conversational_chat(prompt, name_input)
|
133 |
+
# Count words in the generated bio
|
134 |
+
bio_word_count = word_count(bio)
|
135 |
+
st.write(f"Generated Bio Word Count: {bio_word_count}")
|
136 |
+
st.write(bio)
|
137 |
st.write(bio)
|
138 |
|
139 |
|