derek-thomas HF staff commited on
Commit
e093898
1 Parent(s): 9633962

Removing HyDE for now

Browse files
Files changed (1) hide show
  1. app.py +49 -48
app.py CHANGED
@@ -90,8 +90,10 @@ A retriever ([sentence-transformers/paraphrase-multilingual-MiniLM-L12-v2](https
90
  You can see the prompt clearly displayed below the chatbot to understand what is going to the LLM.
91
 
92
  # Read this if you get an error
93
- I'm using Inference Endpoint's Scale to Zero to save money on GPUs. If the staus shows its not "Running" send a
94
- click **Wakeup** to wake it up. You will get a `500 error` and it will take ~7 minutes to wake up.
 
 
95
  """
96
 
97
 
@@ -104,10 +106,8 @@ def process_example(text, history=[]):
104
 
105
  with gr.Blocks() as demo:
106
  gr.Markdown(intro_md)
107
- with gr.Column(scale=3):
108
- endpoint_status = RichTextbox(check_endpoint_status, label="Inference Endpoint Status", every=1)
109
- with gr.Column(scale=1):
110
- wakeup_endpoint = gr.Button('Click to Wake Up Endpoint')
111
  with gr.Tab("Arabic-RAG"):
112
  chatbot = gr.Chatbot(
113
  [],
@@ -152,48 +152,49 @@ with gr.Blocks() as demo:
152
  # Turn it back on
153
  txt_msg.then(lambda: gr.Textbox(interactive=True), None, [txt], queue=False)
154
 
155
- with gr.Tab("Arabic-RAG + HyDE"):
156
- hyde_chatbot = gr.Chatbot(
157
- [],
158
- elem_id="chatbot",
159
- avatar_images=('https://aui.atlassian.com/aui/8.8/docs/images/avatar-person.svg',
160
- 'https://huggingface.co/datasets/huggingface/brand-assets/resolve/main/hf-logo.svg'),
161
- bubble_full_width=False,
162
- show_copy_button=True,
163
- show_share_button=True,
164
- )
165
-
166
- with gr.Row():
167
- hyde_txt = gr.Textbox(
168
- scale=3,
169
- show_label=False,
170
- placeholder="Enter text and press enter",
171
- container=False,
172
- )
173
- hyde_txt_btn = gr.Button(value="Submit text", scale=1)
174
-
175
- hyde_prompt_html = gr.HTML()
176
- gr.Examples(
177
- examples=examples,
178
- inputs=hyde_txt,
179
- outputs=[hyde_chatbot, hyde_prompt_html],
180
- fn=process_example,
181
- cache_examples=True, )
182
- # prompt_html.render()
183
- # Turn off interactivity while generating if you click
184
- hyde_txt_msg = hyde_txt_btn.click(add_text, [hyde_chatbot, hyde_txt], [hyde_chatbot, hyde_txt],
185
- queue=False).then(
186
- partial(bot, hyde=True), [hyde_chatbot], [hyde_chatbot, hyde_prompt_html])
187
-
188
- # Turn it back on
189
- hyde_txt_msg.then(lambda: gr.Textbox(interactive=True), None, [hyde_txt], queue=False)
190
-
191
- # Turn off interactivity while generating if you hit enter
192
- hyde_txt_msg = hyde_txt.submit(add_text, [hyde_chatbot, hyde_txt], [hyde_chatbot, hyde_txt], queue=False).then(
193
- partial(bot, hyde=True), [hyde_chatbot], [hyde_chatbot, hyde_prompt_html])
194
-
195
- # Turn it back on
196
- hyde_txt_msg.then(lambda: gr.Textbox(interactive=True), None, [hyde_txt], queue=False)
 
197
  wakeup_endpoint.click(partial(generate,'Wakeup'))
198
 
199
  demo.queue()
 
90
  You can see the prompt clearly displayed below the chatbot to understand what is going to the LLM.
91
 
92
  # Read this if you get an error
93
+ I'm using [Inference Endpoint's](https://huggingface.co/inference-endpoints)
94
+ [Scale to Zero](https://huggingface.co/docs/inference-endpoints/main/en/autoscaling#scaling-to-0) to save money on GPUs.
95
+ If the staus shows its not "Running" send a click **Wakeup** to wake it up. You will get a `500 error` and it will take
96
+ ~4 minutes to wake up.
97
  """
98
 
99
 
 
106
 
107
  with gr.Blocks() as demo:
108
  gr.Markdown(intro_md)
109
+ endpoint_status = RichTextbox(check_endpoint_status, label="Inference Endpoint Status", every=1)
110
+ wakeup_endpoint = gr.Button('Click to Wake Up Endpoint')
 
 
111
  with gr.Tab("Arabic-RAG"):
112
  chatbot = gr.Chatbot(
113
  [],
 
152
  # Turn it back on
153
  txt_msg.then(lambda: gr.Textbox(interactive=True), None, [txt], queue=False)
154
 
155
+ # Easy to turn this on when I want to
156
+ # with gr.Tab("Arabic-RAG + HyDE"):
157
+ # hyde_chatbot = gr.Chatbot(
158
+ # [],
159
+ # elem_id="chatbot",
160
+ # avatar_images=('https://aui.atlassian.com/aui/8.8/docs/images/avatar-person.svg',
161
+ # 'https://huggingface.co/datasets/huggingface/brand-assets/resolve/main/hf-logo.svg'),
162
+ # bubble_full_width=False,
163
+ # show_copy_button=True,
164
+ # show_share_button=True,
165
+ # )
166
+ #
167
+ # with gr.Row():
168
+ # hyde_txt = gr.Textbox(
169
+ # scale=3,
170
+ # show_label=False,
171
+ # placeholder="Enter text and press enter",
172
+ # container=False,
173
+ # )
174
+ # hyde_txt_btn = gr.Button(value="Submit text", scale=1)
175
+ #
176
+ # hyde_prompt_html = gr.HTML()
177
+ # gr.Examples(
178
+ # examples=examples,
179
+ # inputs=hyde_txt,
180
+ # outputs=[hyde_chatbot, hyde_prompt_html],
181
+ # fn=process_example,
182
+ # cache_examples=True, )
183
+ # # prompt_html.render()
184
+ # # Turn off interactivity while generating if you click
185
+ # hyde_txt_msg = hyde_txt_btn.click(add_text, [hyde_chatbot, hyde_txt], [hyde_chatbot, hyde_txt],
186
+ # queue=False).then(
187
+ # partial(bot, hyde=True), [hyde_chatbot], [hyde_chatbot, hyde_prompt_html])
188
+ #
189
+ # # Turn it back on
190
+ # hyde_txt_msg.then(lambda: gr.Textbox(interactive=True), None, [hyde_txt], queue=False)
191
+ #
192
+ # # Turn off interactivity while generating if you hit enter
193
+ # hyde_txt_msg = hyde_txt.submit(add_text, [hyde_chatbot, hyde_txt], [hyde_chatbot, hyde_txt], queue=False).then(
194
+ # partial(bot, hyde=True), [hyde_chatbot], [hyde_chatbot, hyde_prompt_html])
195
+ #
196
+ # # Turn it back on
197
+ # hyde_txt_msg.then(lambda: gr.Textbox(interactive=True), None, [hyde_txt], queue=False)
198
  wakeup_endpoint.click(partial(generate,'Wakeup'))
199
 
200
  demo.queue()