Spaces:
Sleeping
Sleeping
Commit
•
05e5422
1
Parent(s):
030d561
Update app.py
Browse files
app.py
CHANGED
@@ -18,7 +18,7 @@ def compare_sentences(sentence1, sentence2):
|
|
18 |
def generate_gpt2_response(question):
|
19 |
input_ids = tokenizer.encode(question, return_tensors='pt').to(model.device)
|
20 |
if input_ids.size(1) == 0:
|
21 |
-
return "Generated response is empty
|
22 |
generated_output = model.generate(input_ids, max_length=len(input_ids[0]) + 100,
|
23 |
num_beams=5,
|
24 |
no_repeat_ngram_size=2,
|
@@ -63,8 +63,8 @@ if __name__ == '__main__':
|
|
63 |
while True:
|
64 |
|
65 |
user_input = st.text_area("Enter your question:")
|
66 |
-
|
67 |
-
|
68 |
response = find_question_and_answer(json_file_path, user_input)
|
69 |
st.write(response)
|
70 |
|
|
|
18 |
def generate_gpt2_response(question):
|
19 |
input_ids = tokenizer.encode(question, return_tensors='pt').to(model.device)
|
20 |
if input_ids.size(1) == 0:
|
21 |
+
return "Generated response is empty OR Input your question"
|
22 |
generated_output = model.generate(input_ids, max_length=len(input_ids[0]) + 100,
|
23 |
num_beams=5,
|
24 |
no_repeat_ngram_size=2,
|
|
|
63 |
while True:
|
64 |
|
65 |
user_input = st.text_area("Enter your question:")
|
66 |
+
if user_input.lower() == 'exit':
|
67 |
+
break
|
68 |
response = find_question_and_answer(json_file_path, user_input)
|
69 |
st.write(response)
|
70 |
|