Spaces:
Build error
Build error
add a label to the feedback box
Browse files
app.py
CHANGED
|
@@ -7,18 +7,6 @@ import torch
|
|
| 7 |
import gradio as gr
|
| 8 |
|
| 9 |
|
| 10 |
-
# def chat(message, history):
|
| 11 |
-
# history = history if history is not None else []
|
| 12 |
-
# new_user_input_ids = tokenizer.encode(message+tokenizer.eos_token, return_tensors='pt')
|
| 13 |
-
# bot_input_ids = torch.cat([torch.LongTensor(history), new_user_input_ids], dim=-1)
|
| 14 |
-
# history = model.generate(bot_input_ids, max_length=500, pad_token_id=tokenizer.eos_token_id).tolist()
|
| 15 |
-
# # response = tokenizer.decode(history[0]).replace("<|endoftext|>", "\n")
|
| 16 |
-
# # pretty print last ouput tokens from bot
|
| 17 |
-
# response = tokenizer.decode(bot_input_ids.shape[-1][0], skip_special_tokens=True)
|
| 18 |
-
# print("The response is ", [response])
|
| 19 |
-
# # history.append((message, response, new_user_input_ids, chat_history_ids))
|
| 20 |
-
# return response, history, feedback(message)
|
| 21 |
-
|
| 22 |
|
| 23 |
def chat(message, history=[]):
|
| 24 |
new_user_input_ids = tokenizer.encode(message+tokenizer.eos_token, return_tensors='pt')
|
|
@@ -49,8 +37,12 @@ def feedback(text):
|
|
| 49 |
iface = gr.Interface(
|
| 50 |
chat,
|
| 51 |
["text", "state"],
|
| 52 |
-
["chatbot", "state",
|
| 53 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 54 |
allow_flagging="never",
|
| 55 |
)
|
| 56 |
iface.launch()
|
|
|
|
| 7 |
import gradio as gr
|
| 8 |
|
| 9 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
|
| 11 |
def chat(message, history=[]):
|
| 12 |
new_user_input_ids = tokenizer.encode(message+tokenizer.eos_token, return_tensors='pt')
|
|
|
|
| 37 |
iface = gr.Interface(
|
| 38 |
chat,
|
| 39 |
["text", "state"],
|
| 40 |
+
["chatbot", "state", gr.Textbox(
|
| 41 |
+
label="Feedback",
|
| 42 |
+
lines=1,
|
| 43 |
+
value="Feedback on use of language will appear here",
|
| 44 |
+
)],
|
| 45 |
+
allow_screenshot=True,
|
| 46 |
allow_flagging="never",
|
| 47 |
)
|
| 48 |
iface.launch()
|