Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -3,7 +3,11 @@ import transformers
|
|
3 |
import numpy as np
|
4 |
|
5 |
# Load the pre-trained model
|
6 |
-
|
|
|
|
|
|
|
|
|
7 |
|
8 |
# Define the Streamlit app
|
9 |
def main():
|
@@ -12,12 +16,20 @@ def main():
|
|
12 |
|
13 |
if st.button("Generate Topics"):
|
14 |
# Generate topics
|
15 |
-
|
|
|
|
|
|
|
|
|
16 |
|
17 |
# Print topics
|
18 |
st.write("Top 5 topics:")
|
19 |
for i in range(5):
|
20 |
-
st.write(f"{i+1}. {
|
|
|
|
|
|
|
|
|
21 |
|
22 |
if __name__ == "__main__":
|
23 |
main()
|
|
|
3 |
import numpy as np
|
4 |
|
5 |
# Load the pre-trained model
|
6 |
+
model1 = transformers.pipeline("text2text-generation", model="bigscience/T0pp")
|
7 |
+
model2 = transformers.pipeline("text2text-generation", model="google/flan-t5-xxl")
|
8 |
+
model3 = transformers.pipeline("text2text-generation", model="google/flan-t5-xl")
|
9 |
+
model4 = transformers.pipeline("text2text-generation", model="tuner007/pegasus_paraphrase")
|
10 |
+
model5 = transformers.pipeline("text2text-generation", model="tuner007/pegasus_paraphrase")
|
11 |
|
12 |
# Define the Streamlit app
|
13 |
def main():
|
|
|
16 |
|
17 |
if st.button("Generate Topics"):
|
18 |
# Generate topics
|
19 |
+
topics1 = model1(text, max_length=50, do_sample=True, num_beams=5, temperature=0.7)
|
20 |
+
topics2 = model2(text, max_length=50, do_sample=True, num_beams=5, temperature=0.7)
|
21 |
+
topics3 = model3(text, max_length=50, do_sample=True, num_beams=5, temperature=0.7)
|
22 |
+
topics4 = model4(text, max_length=50, do_sample=True, num_beams=5, temperature=0.7)
|
23 |
+
topics5 = model5(text, max_length=50, do_sample=True, num_beams=5, temperature=0.7)
|
24 |
|
25 |
# Print topics
|
26 |
st.write("Top 5 topics:")
|
27 |
for i in range(5):
|
28 |
+
st.write(f"{i+1}. {topics1[i]['generated_text']}")
|
29 |
+
st.write(f"{i+1}. {topics2[i]['generated_text']}")
|
30 |
+
st.write(f"{i+1}. {topics3[i]['generated_text']}")
|
31 |
+
st.write(f"{i+1}. {topics4[i]['generated_text']}")
|
32 |
+
st.write(f"{i+1}. {topics5[i]['generated_text']}")
|
33 |
|
34 |
if __name__ == "__main__":
|
35 |
main()
|