janders555 commited on
Commit
99f274a
1 Parent(s): 882bdb2

Add requirements.txt

Browse files
Files changed (2) hide show
  1. app.py +0 -48
  2. requirements.txt +3 -0
app.py CHANGED
@@ -2,12 +2,6 @@ import gradio as gr
2
  from sentence_transformers import SentenceTransformer
3
  from sklearn.metrics.pairwise import cosine_similarity
4
  import time
5
- import os
6
- # I needed my Hugging Face token to be set in the environment variables
7
- # to allow me to use the Hugging Face API to retrieve some of the models.
8
- # I have removed the token from the code for security reasons. Plus I don't
9
- # need it now that the models are downloaded.
10
- os.environ['HF_TOKEN'] = 'hf_XLm......'
11
 
12
  sentences = [
13
  # "Yes, Route 359 is located entirely within the town of Skaneateles, ",
@@ -53,48 +47,6 @@ def run_model(model_name, passage_1, passage_2):
53
  return '\n'.join(messages)
54
 
55
 
56
- # def update_text(index):
57
- # """Updates the text box based on the radio button selection."""
58
- # text = sentences[index]
59
- # return text
60
-
61
-
62
- # with gr.Blocks() as interface:
63
- # gr.Markdown("# Sentence Transformer Embeddings")
64
- # # description = "This is a demo of the Sentence Transformers library."
65
- # model_name = gr.Dropdown(
66
- # choices=['sentence-transformers/all-MiniLM-L6-v2',
67
- # 'sentence-transformers/all-mpnet-base-v2',
68
- # 'sentence-transformers/msmarco-distilroberta-base-v2',],
69
- # value='sentence-transformers/all-MiniLM-L6-v2',
70
- # label="Choose Model",
71
- # type="value")
72
- # radio = gr.Radio(
73
- # choices=[sentence[:72] + ' ...' for sentence in sentences],
74
- # label="Pick a passage (optional)",
75
- # type="index")
76
-
77
- # # Create a text box to display the selection
78
- # passage_1 = gr.Textbox(
79
- # label="Passage 1",
80
- # placeholder="Pick passage from above or enter your own.",)
81
-
82
- # # Connect the radio button change event to the update_text function
83
- # radio.change(update_text, inputs=radio, outputs=passage_1)
84
-
85
- # passage_2 = gr.Textbox(
86
- # label="Passage 2",
87
- # placeholder="Enter a passage to compare to passage 1.",
88
- # type="text")
89
-
90
- # button = gr.Button(value="Submit")
91
-
92
- # # Connect the button click event to the submit_button_clicked function, passing radio choice
93
- # button.click(run_model, inputs=[
94
- # model_name, passage_1, passage_2], outputs=gr.Textbox(label="Results"))
95
-
96
- # interface.launch()
97
-
98
  app = gr.Interface(
99
  fn=run_model,
100
  inputs=[
 
2
  from sentence_transformers import SentenceTransformer
3
  from sklearn.metrics.pairwise import cosine_similarity
4
  import time
 
 
 
 
 
 
5
 
6
  sentences = [
7
  # "Yes, Route 359 is located entirely within the town of Skaneateles, ",
 
47
  return '\n'.join(messages)
48
 
49
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
50
  app = gr.Interface(
51
  fn=run_model,
52
  inputs=[
requirements.txt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ gradio==4.27.0
2
+ scikit_learn==1.3.0
3
+ sentence_transformers==2.5.1