Spaces:
Build error
Build error
Add examples to dataframe
Browse files
app.py
CHANGED
@@ -50,7 +50,7 @@ def get_similar_quotes(philosopher, question):
|
|
50 |
ind = np.argpartition(sims, -5)[-5:]
|
51 |
similar_sentences = [df['quote'][i] for i in ind]
|
52 |
top5quotes = pd.DataFrame(data = similar_sentences, columns=["Quotes"], index=range(1,6))
|
53 |
-
top5quotes['Quotes'] =
|
54 |
return top5quotes
|
55 |
|
56 |
def main(question, philosopher):
|
@@ -81,7 +81,12 @@ with gr.Blocks(css=".gradio-container {background-image: url('file=mountains_res
|
|
81 |
headers=["Quotes"],
|
82 |
max_rows=5,
|
83 |
interactive=False,
|
84 |
-
wrap=True
|
|
|
|
|
|
|
|
|
|
|
85 |
|
86 |
btn = gr.Button("Run")
|
87 |
btn.click(fn=main, inputs=[inp1,inp2], outputs=[out1,out2,out_image])
|
|
|
50 |
ind = np.argpartition(sims, -5)[-5:]
|
51 |
similar_sentences = [df['quote'][i] for i in ind]
|
52 |
top5quotes = pd.DataFrame(data = similar_sentences, columns=["Quotes"], index=range(1,6))
|
53 |
+
top5quotes['Quotes'] = top5quotes['Quotes'].str[:-1].str[:250] + "..."
|
54 |
return top5quotes
|
55 |
|
56 |
def main(question, philosopher):
|
|
|
81 |
headers=["Quotes"],
|
82 |
max_rows=5,
|
83 |
interactive=False,
|
84 |
+
wrap=True
|
85 |
+
value=[["When you arise in the morning, think of what a precious privilege it is to be alive – to breathe, to think, to enjoy, to love.",
|
86 |
+
"Each day provides its own gifts.",
|
87 |
+
"Only time can heal what reason cannot.",
|
88 |
+
"He who is brave is free.",
|
89 |
+
"First learn the meaning of what you say, and then speak."]]
|
90 |
|
91 |
btn = gr.Button("Run")
|
92 |
btn.click(fn=main, inputs=[inp1,inp2], outputs=[out1,out2,out_image])
|