Spaces:
Running
Running
DeepLearning101
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -3,7 +3,6 @@ import gradio as gr
|
|
3 |
import aiohttp
|
4 |
import asyncio
|
5 |
import json
|
6 |
-
from functools import lru_cache
|
7 |
from datasets import Dataset, DatasetDict, load_dataset
|
8 |
from huggingface_hub import HfFolder
|
9 |
|
@@ -42,7 +41,6 @@ except:
|
|
42 |
})
|
43 |
})
|
44 |
|
45 |
-
@lru_cache(maxsize=32)
|
46 |
async def send_chat_message(LLM_URL, LLM_API, user_input):
|
47 |
payload = {
|
48 |
"inputs": {},
|
@@ -170,7 +168,6 @@ with gr.Blocks() as iface:
|
|
170 |
gr.Examples(examples=examples, inputs=user_input)
|
171 |
|
172 |
with gr.Row():
|
173 |
-
# like_button = gr.Button(" 👍 覺得答案很棒,請按我;或者直接繼續問新問題亦可")
|
174 |
dislike_button = gr.Button(" 👎 覺得答案待改善,請輸入改進建議,再按我送出保存")
|
175 |
improvement_input = gr.Textbox(label='請輸入改進建議', placeholder='請輸入如何改進模型回應的建議')
|
176 |
|
@@ -187,12 +184,6 @@ with gr.Blocks() as iface:
|
|
187 |
|
188 |
submit_button.click(fn=chat, inputs=[user_input, chatbot], outputs=[chatbot, chatbot])
|
189 |
|
190 |
-
# like_button.click(
|
191 |
-
# fn=lambda response, improvement: handle_feedback(response, "like", improvement),
|
192 |
-
# inputs=[chatbot, improvement_input],
|
193 |
-
# outputs=feedback_output
|
194 |
-
# )
|
195 |
-
|
196 |
dislike_button.click(
|
197 |
fn=lambda response, improvement: handle_feedback(response, "dislike", improvement),
|
198 |
inputs=[chatbot, improvement_input],
|
@@ -201,4 +192,4 @@ with gr.Blocks() as iface:
|
|
201 |
|
202 |
show_feedback_button.click(fn=show_feedback, outputs=feedback_display)
|
203 |
|
204 |
-
iface.launch()
|
|
|
3 |
import aiohttp
|
4 |
import asyncio
|
5 |
import json
|
|
|
6 |
from datasets import Dataset, DatasetDict, load_dataset
|
7 |
from huggingface_hub import HfFolder
|
8 |
|
|
|
41 |
})
|
42 |
})
|
43 |
|
|
|
44 |
async def send_chat_message(LLM_URL, LLM_API, user_input):
|
45 |
payload = {
|
46 |
"inputs": {},
|
|
|
168 |
gr.Examples(examples=examples, inputs=user_input)
|
169 |
|
170 |
with gr.Row():
|
|
|
171 |
dislike_button = gr.Button(" 👎 覺得答案待改善,請輸入改進建議,再按我送出保存")
|
172 |
improvement_input = gr.Textbox(label='請輸入改進建議', placeholder='請輸入如何改進模型回應的建議')
|
173 |
|
|
|
184 |
|
185 |
submit_button.click(fn=chat, inputs=[user_input, chatbot], outputs=[chatbot, chatbot])
|
186 |
|
|
|
|
|
|
|
|
|
|
|
|
|
187 |
dislike_button.click(
|
188 |
fn=lambda response, improvement: handle_feedback(response, "dislike", improvement),
|
189 |
inputs=[chatbot, improvement_input],
|
|
|
192 |
|
193 |
show_feedback_button.click(fn=show_feedback, outputs=feedback_display)
|
194 |
|
195 |
+
iface.launch()
|