eduardo-alvarez
commited on
Commit
β’
be7b294
1
Parent(s):
24086b0
Update app.py
Browse files
app.py
CHANGED
@@ -50,33 +50,35 @@ with demo:
|
|
50 |
|
51 |
#chat_model_selection = chat_model_dropdown.value
|
52 |
chat_model_selection = 'Intel/neural-chat-7b-v1-1'
|
|
|
|
|
53 |
|
54 |
-
def call_api_and_stream_response(query, chat_model):
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
def get_response(query, history):
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
gr.ChatInterface(get_response, retry_btn = None, undo_btn=None, concurrency_limit=inference_concurrency_limit).launch()
|
80 |
|
81 |
with gr.Tabs(elem_classes="tab-buttons") as tabs:
|
82 |
with gr.TabItem("π LLM Leadeboard", elem_id="llm-benchmark-table", id=0):
|
|
|
50 |
|
51 |
#chat_model_selection = chat_model_dropdown.value
|
52 |
chat_model_selection = 'Intel/neural-chat-7b-v1-1'
|
53 |
+
|
54 |
+
gr.ChatInterface()
|
55 |
|
56 |
+
#def call_api_and_stream_response(query, chat_model):
|
57 |
+
# """
|
58 |
+
# Call the API endpoint and yield characters as they are received.
|
59 |
+
# This function simulates streaming by yielding characters one by one.
|
60 |
+
# """
|
61 |
+
# url = inference_endpoint_url
|
62 |
+
# params = {"query": query,"selected_model":chat_model}
|
63 |
+
# with requests.get(url, json=params, stream=True) as r:
|
64 |
+
# for chunk in r.iter_content(chunk_size=1):
|
65 |
+
# if chunk:
|
66 |
+
# yield chunk.decode()
|
67 |
+
#def get_response(query, history):
|
68 |
+
# """
|
69 |
+
# Wrapper function to call the streaming API and compile the response.
|
70 |
+
# """
|
71 |
+
# response = ''
|
72 |
+
#
|
73 |
+
# global chat_model_selection
|
74 |
+
#
|
75 |
+
# for char in call_api_and_stream_response(query, chat_model=chat_model_selection):
|
76 |
+
# if char == '<':
|
77 |
+
# break
|
78 |
+
# response += char
|
79 |
+
# yield response
|
80 |
+
#
|
81 |
+
#gr.ChatInterface(get_response, retry_btn = None, undo_btn=None, concurrency_limit=inference_concurrency_limit).launch()
|
82 |
|
83 |
with gr.Tabs(elem_classes="tab-buttons") as tabs:
|
84 |
with gr.TabItem("π LLM Leadeboard", elem_id="llm-benchmark-table", id=0):
|