akhaliq HF staff commited on
Commit
684bece
1 Parent(s): 8c97520

add perplexity

Browse files
Files changed (2) hide show
  1. app.py +49 -0
  2. requirements.txt +2 -1
app.py CHANGED
@@ -5,6 +5,8 @@ import anthropic_gradio
5
  import sambanova_gradio
6
  import xai_gradio
7
  import hyperbolic_gradio
 
 
8
 
9
 
10
  with gr.Blocks(fill_height=True) as demo:
@@ -169,6 +171,53 @@ with gr.Blocks(fill_height=True) as demo:
169
  src=hyperbolic_gradio.registry,
170
  accept_token=True
171
  )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
172
 
173
 
174
  demo.launch()
 
5
  import sambanova_gradio
6
  import xai_gradio
7
  import hyperbolic_gradio
8
+ import perplexity_gradio
9
+
10
 
11
 
12
  with gr.Blocks(fill_height=True) as demo:
 
171
  src=hyperbolic_gradio.registry,
172
  accept_token=True
173
  )
174
+ with gr.Tab("Perplexity"):
175
+ with gr.Row():
176
+ perplexity_model = gr.Dropdown(
177
+ choices=[
178
+ # Sonar Models (Online)
179
+ 'llama-3.1-sonar-small-128k-online', # 8B params
180
+ 'llama-3.1-sonar-large-128k-online', # 70B params
181
+ 'llama-3.1-sonar-huge-128k-online', # 405B params
182
+ # Sonar Models (Chat)
183
+ 'llama-3.1-sonar-small-128k-chat', # 8B params
184
+ 'llama-3.1-sonar-large-128k-chat', # 70B params
185
+ # Open Source Models
186
+ 'llama-3.1-8b-instruct', # 8B params
187
+ 'llama-3.1-70b-instruct' # 70B params
188
+ ],
189
+ value='llama-3.1-sonar-large-128k-online', # Default to large online model
190
+ label="Select Perplexity Model",
191
+ interactive=True
192
+ )
193
+
194
+ perplexity_interface = gr.load(
195
+ name=perplexity_model.value,
196
+ src=perplexity_gradio.registry,
197
+ accept_token=True
198
+ )
199
+
200
+ def update_perplexity_model(new_model):
201
+ return gr.load(
202
+ name=new_model,
203
+ src=perplexity_gradio.registry,
204
+ accept_token=True
205
+ )
206
+
207
+ perplexity_model.change(
208
+ fn=update_perplexity_model,
209
+ inputs=[perplexity_model],
210
+ outputs=[perplexity_interface]
211
+ )
212
+
213
+ gr.Markdown("""
214
+ **Note:** Models are grouped into three categories:
215
+ - **Sonar Online Models**: Include search capabilities (beta access required)
216
+ - **Sonar Chat Models**: Standard chat models
217
+ - **Open Source Models**: Based on Hugging Face implementations
218
+
219
+ For access to Online LLMs features, please fill out the [beta access form](https://forms.perplexity.ai).
220
+ """)
221
 
222
 
223
  demo.launch()
requirements.txt CHANGED
@@ -3,4 +3,5 @@ openai-gradio
3
  git+https://github.com/AK391/anthropic-gradio.git
4
  sambanova-gradio
5
  git+https://github.com/AK391/xai-gradio.git
6
- git+https://github.com/AK391/hyperbolic-gradio.git
 
 
3
  git+https://github.com/AK391/anthropic-gradio.git
4
  sambanova-gradio
5
  git+https://github.com/AK391/xai-gradio.git
6
+ git+https://github.com/AK391/hyperbolic-gradio.git
7
+ git+https://github.com/AK391/perplexity-gradio.git