Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
allen working
Browse files- app.py +3 -0
- app_allenai.py +7 -13
app.py
CHANGED
@@ -1,5 +1,6 @@
|
|
1 |
import gradio as gr
|
2 |
|
|
|
3 |
from app_claude import demo as demo_claude
|
4 |
from app_experimental import demo as demo_experimental
|
5 |
from app_fireworks import demo as demo_fireworks
|
@@ -19,6 +20,8 @@ from app_together import demo as demo_together
|
|
19 |
from app_xai import demo as demo_grok
|
20 |
|
21 |
with gr.Blocks(fill_height=True) as demo:
|
|
|
|
|
22 |
with gr.Tab("Hyperbolic"):
|
23 |
demo_hyperbolic.render()
|
24 |
gr.Markdown(
|
|
|
1 |
import gradio as gr
|
2 |
|
3 |
+
from app_allenai import demo as demo_allenai
|
4 |
from app_claude import demo as demo_claude
|
5 |
from app_experimental import demo as demo_experimental
|
6 |
from app_fireworks import demo as demo_fireworks
|
|
|
20 |
from app_xai import demo as demo_grok
|
21 |
|
22 |
with gr.Blocks(fill_height=True) as demo:
|
23 |
+
with gr.Tab("AllenAI"):
|
24 |
+
demo_allenai.render()
|
25 |
with gr.Tab("Hyperbolic"):
|
26 |
demo_hyperbolic.render()
|
27 |
gr.Markdown(
|
app_allenai.py
CHANGED
@@ -2,8 +2,8 @@ from gradio_client import Client
|
|
2 |
import gradio as gr
|
3 |
|
4 |
MODELS = {
|
5 |
-
"
|
6 |
-
"
|
7 |
}
|
8 |
|
9 |
def create_chat_fn(client):
|
@@ -21,7 +21,7 @@ def create_chat_fn(client):
|
|
21 |
return response
|
22 |
return chat
|
23 |
|
24 |
-
def set_client_for_session(model_name
|
25 |
headers = {}
|
26 |
if request and hasattr(request, 'request') and hasattr(request.request, 'headers'):
|
27 |
x_ip_token = request.request.headers.get('x-ip-token')
|
@@ -36,26 +36,18 @@ def safe_chat_fn(message, history, client):
|
|
36 |
return create_chat_fn(client)(message, history)
|
37 |
|
38 |
with gr.Blocks() as interface:
|
39 |
-
gr.Markdown("# AI Chat Interface")
|
40 |
|
41 |
client = gr.State()
|
42 |
|
43 |
model_dropdown = gr.Dropdown(
|
44 |
choices=list(MODELS.keys()),
|
45 |
-
value="
|
46 |
label="Select Model",
|
47 |
interactive=True
|
48 |
)
|
49 |
|
50 |
chat_interface = gr.ChatInterface(
|
51 |
fn=safe_chat_fn,
|
52 |
-
title="",
|
53 |
-
description="Chat with AI",
|
54 |
-
examples=[
|
55 |
-
["Hello! How are you?", None],
|
56 |
-
["What is machine learning?", None]
|
57 |
-
],
|
58 |
-
cache_examples=False,
|
59 |
additional_inputs=[client]
|
60 |
)
|
61 |
|
@@ -72,8 +64,10 @@ with gr.Blocks() as interface:
|
|
72 |
# Initialize client on page load
|
73 |
interface.load(
|
74 |
fn=set_client_for_session,
|
75 |
-
inputs=gr.State("
|
76 |
outputs=client,
|
77 |
)
|
78 |
|
|
|
|
|
79 |
|
|
|
2 |
import gradio as gr
|
3 |
|
4 |
MODELS = {
|
5 |
+
"OLMo-2-1124-13B-Instruct": "akhaliq/olmo-anychat",
|
6 |
+
"Llama-3.1-Tulu-3-8B": "akhaliq/allen-test"
|
7 |
}
|
8 |
|
9 |
def create_chat_fn(client):
|
|
|
21 |
return response
|
22 |
return chat
|
23 |
|
24 |
+
def set_client_for_session(model_name, request=None):
|
25 |
headers = {}
|
26 |
if request and hasattr(request, 'request') and hasattr(request.request, 'headers'):
|
27 |
x_ip_token = request.request.headers.get('x-ip-token')
|
|
|
36 |
return create_chat_fn(client)(message, history)
|
37 |
|
38 |
with gr.Blocks() as interface:
|
|
|
39 |
|
40 |
client = gr.State()
|
41 |
|
42 |
model_dropdown = gr.Dropdown(
|
43 |
choices=list(MODELS.keys()),
|
44 |
+
value="OLMo-2-1124-13B-Instruct",
|
45 |
label="Select Model",
|
46 |
interactive=True
|
47 |
)
|
48 |
|
49 |
chat_interface = gr.ChatInterface(
|
50 |
fn=safe_chat_fn,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
51 |
additional_inputs=[client]
|
52 |
)
|
53 |
|
|
|
64 |
# Initialize client on page load
|
65 |
interface.load(
|
66 |
fn=set_client_for_session,
|
67 |
+
inputs=gr.State("OLMo-2-1124-13B-Instruct"),
|
68 |
outputs=client,
|
69 |
)
|
70 |
|
71 |
+
interface.launch()
|
72 |
+
|
73 |
|