eduardo-alvarez
commited on
Commit
β’
0fbd2eb
1
Parent(s):
59a3f5e
updating chatbot
Browse files- app.py +3 -12
- requirements.txt +2 -0
app.py
CHANGED
@@ -2,7 +2,6 @@ import gradio as gr
|
|
2 |
import pandas as pd
|
3 |
import requests
|
4 |
import os
|
5 |
-
import time
|
6 |
|
7 |
from info.train_a_model import (
|
8 |
LLM_BENCHMARKS_TEXT)
|
@@ -51,7 +50,7 @@ with demo:
|
|
51 |
|
52 |
#chat_model_selection = chat_model_dropdown.value
|
53 |
chat_model_selection = 'Intel/neural-chat-7b-v1-1'
|
54 |
-
|
55 |
def call_api_and_stream_response(query, chat_model):
|
56 |
"""
|
57 |
Call the API endpoint and yield characters as they are received.
|
@@ -63,6 +62,7 @@ with demo:
|
|
63 |
for chunk in r.iter_content(chunk_size=1):
|
64 |
if chunk:
|
65 |
yield chunk.decode()
|
|
|
66 |
def get_response(query, history):
|
67 |
"""
|
68 |
Wrapper function to call the streaming API and compile the response.
|
@@ -76,17 +76,8 @@ with demo:
|
|
76 |
break
|
77 |
response += char
|
78 |
yield response
|
79 |
-
|
80 |
-
def user(user_message, history):
|
81 |
-
return "", history + [[user_message, None]]
|
82 |
-
|
83 |
-
with gr.Blocks():
|
84 |
-
chatbot = gr.Chatbot()
|
85 |
-
msg = gr.Textbox()
|
86 |
-
clear = gr.ClearButton([msg, chatbot])
|
87 |
|
88 |
-
|
89 |
-
clear.click(lambda: None, None, chatbot, queue=False)
|
90 |
|
91 |
with gr.Tabs(elem_classes="tab-buttons") as tabs:
|
92 |
with gr.TabItem("π LLM Leadeboard", elem_id="llm-benchmark-table", id=0):
|
|
|
2 |
import pandas as pd
|
3 |
import requests
|
4 |
import os
|
|
|
5 |
|
6 |
from info.train_a_model import (
|
7 |
LLM_BENCHMARKS_TEXT)
|
|
|
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 |
Call the API endpoint and yield characters as they are received.
|
|
|
62 |
for chunk in r.iter_content(chunk_size=1):
|
63 |
if chunk:
|
64 |
yield chunk.decode()
|
65 |
+
|
66 |
def get_response(query, history):
|
67 |
"""
|
68 |
Wrapper function to call the streaming API and compile the response.
|
|
|
76 |
break
|
77 |
response += char
|
78 |
yield response
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
79 |
|
80 |
+
gr.ChatInterface(get_response, retry_btn = None, undo_btn=None, concurrency_limit=inference_concurrency_limit).launch()
|
|
|
81 |
|
82 |
with gr.Tabs(elem_classes="tab-buttons") as tabs:
|
83 |
with gr.TabItem("π LLM Leadeboard", elem_id="llm-benchmark-table", id=0):
|
requirements.txt
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
1 |
+
gradio==4.16.0
|
2 |
+
pandas==2.0.3
|