Spaces:
Running
Running
Commit
·
213df71
1
Parent(s):
39c2e97
Update app.py
Browse files
app.py
CHANGED
|
@@ -6,7 +6,17 @@ from sklearn.feature_extraction.text import CountVectorizer
|
|
| 6 |
from sklearn.metrics.pairwise import cosine_similarity
|
| 7 |
import numpy as np
|
| 8 |
pipe=pipeline('sentiment-analysis')
|
| 9 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
|
| 11 |
|
| 12 |
if text:
|
|
@@ -35,19 +45,20 @@ if text:
|
|
| 35 |
|
| 36 |
# Affichage des titres d'articles trouvés
|
| 37 |
if resultats:
|
| 38 |
-
st.write("
|
| 39 |
for row in resultats[:3]:
|
| 40 |
st.json(row[0])
|
| 41 |
else:
|
| 42 |
-
st.json("
|
| 43 |
|
| 44 |
|
| 45 |
conn.close()
|
| 46 |
generator = pipeline("text-generation", model="gpt2") # to modify for another model
|
| 47 |
-
txt=generator(
|
| 48 |
text,
|
| 49 |
max_length=150,
|
| 50 |
num_return_sequences=2,
|
| 51 |
)
|
| 52 |
|
|
|
|
| 53 |
st.write(txt)
|
|
|
|
| 6 |
from sklearn.metrics.pairwise import cosine_similarity
|
| 7 |
import numpy as np
|
| 8 |
pipe=pipeline('sentiment-analysis')
|
| 9 |
+
|
| 10 |
+
text = """
|
| 11 |
+
Welcome to SorboBot, a Hugging Face Space designed to revolutionize the way you find published articles.
|
| 12 |
+
|
| 13 |
+
Powered by a full export from ScanR and Hal at Sorbonne University, SorboBot utilizes advanced language model technology to provide you with a list of published articles based on your prompt
|
| 14 |
+
|
| 15 |
+
Work in progress
|
| 16 |
+
|
| 17 |
+
Write your request:
|
| 18 |
+
"""
|
| 19 |
+
text=st.text_area(text)
|
| 20 |
|
| 21 |
|
| 22 |
if text:
|
|
|
|
| 45 |
|
| 46 |
# Affichage des titres d'articles trouvés
|
| 47 |
if resultats:
|
| 48 |
+
st.write("Titles of articles corresponding to your search:")
|
| 49 |
for row in resultats[:3]:
|
| 50 |
st.json(row[0])
|
| 51 |
else:
|
| 52 |
+
st.json("No artcicles found in the database")
|
| 53 |
|
| 54 |
|
| 55 |
conn.close()
|
| 56 |
generator = pipeline("text-generation", model="gpt2") # to modify for another model
|
| 57 |
+
txt = generator(
|
| 58 |
text,
|
| 59 |
max_length=150,
|
| 60 |
num_return_sequences=2,
|
| 61 |
)
|
| 62 |
|
| 63 |
+
st.write("\n\n")
|
| 64 |
st.write(txt)
|