Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -21,31 +21,13 @@ models = {
|
|
21 |
"Pegasus": "google/pegasus-xsum"
|
22 |
}
|
23 |
|
24 |
-
# Example texts
|
25 |
-
example_texts = {
|
26 |
-
"Example 1": "Artificial intelligence is transforming industries by enhancing productivity and efficiency.",
|
27 |
-
"Example 2": "Machine learning algorithms are becoming more sophisticated, allowing for better data analysis.",
|
28 |
-
"Example 3": "Natural language processing enables machines to understand and respond to human language.",
|
29 |
-
}
|
30 |
-
|
31 |
# Function to count words in the input text
|
32 |
def count_words(text):
|
33 |
return len(text.split())
|
34 |
|
35 |
-
# Function to copy text to clipboard
|
36 |
-
def copy_to_clipboard(text):
|
37 |
-
st.session_state.copied_text = text # Store copied text in session state
|
38 |
-
st.success("Example copied to clipboard!") # Display message
|
39 |
-
|
40 |
# Streamlit app layout
|
41 |
st.title("Summarization with Multiple Models")
|
42 |
|
43 |
-
# Example buttons for text selection
|
44 |
-
st.subheader("Example Texts")
|
45 |
-
for label, example in example_texts.items():
|
46 |
-
if st.button(label):
|
47 |
-
copy_to_clipboard(example) # Copy the example text to clipboard
|
48 |
-
|
49 |
# Dropdown to select the model (bolded)
|
50 |
st.markdown("### **Select a model for summarization**")
|
51 |
model_choice = st.selectbox("", models.keys())
|
|
|
21 |
"Pegasus": "google/pegasus-xsum"
|
22 |
}
|
23 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
24 |
# Function to count words in the input text
|
25 |
def count_words(text):
|
26 |
return len(text.split())
|
27 |
|
|
|
|
|
|
|
|
|
|
|
28 |
# Streamlit app layout
|
29 |
st.title("Summarization with Multiple Models")
|
30 |
|
|
|
|
|
|
|
|
|
|
|
|
|
31 |
# Dropdown to select the model (bolded)
|
32 |
st.markdown("### **Select a model for summarization**")
|
33 |
model_choice = st.selectbox("", models.keys())
|