Update app.py
Browse files
app.py
CHANGED
@@ -40,7 +40,7 @@ def load_memory(filename='chat_memory.pkl'):
|
|
40 |
session_memory = load_memory()
|
41 |
|
42 |
# ---- Response Generation ----
|
43 |
-
def generate_response(prompt, max_length=
|
44 |
inputs = tokenizer(prompt, return_tensors='pt', padding=True, truncation=True, max_length=max_length)
|
45 |
input_ids = inputs['input_ids'].to(device)
|
46 |
attention_mask = inputs['attention_mask'].to(device)
|
@@ -100,7 +100,7 @@ with gr.Blocks() as app:
|
|
100 |
|
101 |
with gr.Row():
|
102 |
with gr.Column(scale=1):
|
103 |
-
user_input = gr.Textbox(label="What will you say to Gertrude?", placeholder="Type something here...
|
104 |
submit_button = gr.Button("Send")
|
105 |
with gr.Column(scale=1):
|
106 |
chatbot = gr.Textbox(label="Gertrude's Response", interactive=False) # This is now a Textbox for output
|
|
|
40 |
session_memory = load_memory()
|
41 |
|
42 |
# ---- Response Generation ----
|
43 |
+
def generate_response(prompt, max_length=35):
|
44 |
inputs = tokenizer(prompt, return_tensors='pt', padding=True, truncation=True, max_length=max_length)
|
45 |
input_ids = inputs['input_ids'].to(device)
|
46 |
attention_mask = inputs['attention_mask'].to(device)
|
|
|
100 |
|
101 |
with gr.Row():
|
102 |
with gr.Column(scale=1):
|
103 |
+
user_input = gr.Textbox(label="What will you say to Gertrude?", placeholder="Type something here...")
|
104 |
submit_button = gr.Button("Send")
|
105 |
with gr.Column(scale=1):
|
106 |
chatbot = gr.Textbox(label="Gertrude's Response", interactive=False) # This is now a Textbox for output
|