Spaces:
Runtime error
Runtime error
Commit
·
2cc38ad
1
Parent(s):
c00a75f
update interface
Browse files
app.py
CHANGED
@@ -47,46 +47,47 @@ def semantic_search(_input, n):
|
|
47 |
result.to_csv('result.csv')
|
48 |
return result, 'result.csv', '\n'.join(_input)
|
49 |
|
50 |
-
|
51 |
-
df.to_csv('result.csv')
|
52 |
-
return 'result.csv'
|
53 |
|
54 |
-
|
55 |
-
|
56 |
-
with demo:
|
57 |
gr.Markdown("# Call2Vec")
|
58 |
-
gr.Markdown("##
|
59 |
with gr.Row():
|
60 |
with gr.Column():
|
61 |
gr.Markdown(
|
62 |
"""
|
63 |
#### Project Description
|
64 |
-
|
|
|
65 |
"""
|
66 |
)
|
67 |
gr.Markdown(
|
68 |
"""
|
69 |
#### App usage:
|
70 |
-
|
71 |
-
|
|
|
|
|
|
|
72 |
##### Examples
|
73 |
-
-
|
74 |
-
-
|
|
|
75 |
"""
|
76 |
)
|
77 |
with gr.Column():
|
78 |
-
text_in = gr.Textbox(lines=1)
|
79 |
with gr.Row():
|
80 |
-
n = gr.Slider(minimum=5, maximum=250, step=5)
|
81 |
compute_bt = gr.Button("Compute")
|
82 |
df_out = gr.Dataframe(interactive=False)
|
83 |
f_out = gr.File(interactive=False)
|
84 |
gr.Markdown(
|
85 |
"""
|
86 |
<div style='text-align: center;'>Call2Vec by X and Y</center></div>
|
87 |
-
|
88 |
"""
|
89 |
)
|
90 |
compute_bt.click(semantic_search, inputs=[text_in, n], outputs=[df_out, f_out, text_in])
|
91 |
|
92 |
-
|
|
|
47 |
result.to_csv('result.csv')
|
48 |
return result, 'result.csv', '\n'.join(_input)
|
49 |
|
50 |
+
app = gr.Blocks()
|
|
|
|
|
51 |
|
52 |
+
with app:
|
|
|
|
|
53 |
gr.Markdown("# Call2Vec")
|
54 |
+
gr.Markdown("## Semantic Search in Quarterly Earnings Conference Calls")
|
55 |
with gr.Row():
|
56 |
with gr.Column():
|
57 |
gr.Markdown(
|
58 |
"""
|
59 |
#### Project Description
|
60 |
+
Call2Vec is a [fastText](https://fasttext.cc/) word embedding model trained via [Gensim](https://radimrehurek.com/gensim/). It maps each token in the vocabulary into a dense, 300-dimensional vector space, designed for performing semantic search.
|
61 |
+
The model is trained on a large sample of quarterly earnings conference calls, held by U.S. firms during the 2006-2022 period. In particular, the training data is restriced to the (rather sponentous) executives' remarks of the Q&A section of the call. The data has been preprocessed prior to model training via stop word removal, lemmatization, named entity masking, and coocurrence modeling.
|
62 |
"""
|
63 |
)
|
64 |
gr.Markdown(
|
65 |
"""
|
66 |
#### App usage:
|
67 |
+
The model is intented to be used for **semantic search**: It encodes the search query (entered in the textbox on the right) in a dense vector space and finds semantic neighbours, i.e., token which frequently occur within similar contexts in the underlying training data.
|
68 |
+
The model allows for two use cases:
|
69 |
+
1. *Single Search:* The input query consists of a single word. When provided a bi-, tri-, or even fourgram, the quality of the model output depends on the presence of the query token in the model's vocabulary. N-grams should be concated by an underscore (e.g., "machine_learning" or "artifical_intelligence").
|
70 |
+
2. *Multi Search:* The input query may consist of several words or n-grams, seperated by comma, semi-colon or newline. It then computes the average vector over all inputs and performs semantic search based on the average input token.
|
71 |
+
|
72 |
##### Examples
|
73 |
+
- transformation
|
74 |
+
- climate_change
|
75 |
+
- risk, political_risk, uncertainty
|
76 |
"""
|
77 |
)
|
78 |
with gr.Column():
|
79 |
+
text_in = gr.Textbox(lines=1, placeholder="Insert search query")
|
80 |
with gr.Row():
|
81 |
+
n = gr.Slider(value=50, minimum=5, maximum=250, step=5, label="Number of Neighbours")
|
82 |
compute_bt = gr.Button("Compute")
|
83 |
df_out = gr.Dataframe(interactive=False)
|
84 |
f_out = gr.File(interactive=False)
|
85 |
gr.Markdown(
|
86 |
"""
|
87 |
<div style='text-align: center;'>Call2Vec by X and Y</center></div>
|
88 |
+
<img id="visitor-badge" alt="visitor badge" src="https://visitor-badge.glitch.me/badge?page_id=simonschoe.call2vec&left_color=green&right_color=red" />'
|
89 |
"""
|
90 |
)
|
91 |
compute_bt.click(semantic_search, inputs=[text_in, n], outputs=[df_out, f_out, text_in])
|
92 |
|
93 |
+
app.launch()
|