thiyagab
commited on
Commit
•
b10d5a0
1
Parent(s):
59baf0d
Changed to gradio
Browse files- app.py +10 -7
- requirements.txt +1 -1
- semanticsearch.py +2 -2
app.py
CHANGED
@@ -1,11 +1,14 @@
|
|
1 |
-
import
|
2 |
|
3 |
import semanticsearch
|
4 |
|
5 |
-
# x = st.slider('Select a value')
|
6 |
-
x=st.text_input('Ask valluvar')
|
7 |
-
# st.write(x, 'squared is', x * x)
|
8 |
-
if (x):
|
9 |
-
|
10 |
-
|
|
|
|
|
|
|
11 |
|
|
|
1 |
+
import gradio as gd
|
2 |
|
3 |
import semanticsearch
|
4 |
|
5 |
+
# # x = st.slider('Select a value')
|
6 |
+
# x=st.text_input('Ask valluvar')
|
7 |
+
# # st.write(x, 'squared is', x * x)
|
8 |
+
# if (x):
|
9 |
+
# response=semanticsearch.find_similarities(x)
|
10 |
+
# st.markdown(response)
|
11 |
+
|
12 |
+
gd.Interface(semanticsearch.find_similarities,inputs=gd.Textbox(lines=1, max_lines=2, label="Ask Valluvar"),outputs=gd.Textbox(interactive=False,lines=10, label="Response")).launch()
|
13 |
+
|
14 |
|
requirements.txt
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
|
2 |
transformers
|
3 |
sentence-transformers
|
4 |
sentence_embeddings
|
|
|
1 |
+
gradio
|
2 |
transformers
|
3 |
sentence-transformers
|
4 |
sentence_embeddings
|
semanticsearch.py
CHANGED
@@ -52,9 +52,9 @@ def find_similarities(input:str):
|
|
52 |
response=''
|
53 |
for index in indices[0]:
|
54 |
print(similarity_matrix[0][index])
|
55 |
-
response+=en_translations[index+1]
|
56 |
print(en_translations[index+1])
|
57 |
-
response += "
|
|
|
58 |
print("\n".join(kurals[index+1]))
|
59 |
return response
|
60 |
|
|
|
52 |
response=''
|
53 |
for index in indices[0]:
|
54 |
print(similarity_matrix[0][index])
|
|
|
55 |
print(en_translations[index+1])
|
56 |
+
response += "\n".join(kurals[index+1])+"\n"
|
57 |
+
response += en_translations[index + 1]+"\n\n"
|
58 |
print("\n".join(kurals[index+1]))
|
59 |
return response
|
60 |
|