Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -24,12 +24,21 @@ time_load_model_end = time.time()
|
|
24 |
elapsed_time = time_load_model_end - time_load_model_start
|
25 |
print(f"Elapsed time to load the model: {elapsed_time:.2f} sec")
|
26 |
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
34 |
demo = gr.Interface(fn=get_answer, inputs="text", outputs="text")
|
35 |
demo.launch(share=True)
|
|
|
24 |
elapsed_time = time_load_model_end - time_load_model_start
|
25 |
print(f"Elapsed time to load the model: {elapsed_time:.2f} sec")
|
26 |
|
27 |
+
def get_answer(chatbot, input_text):
|
28 |
+
start_time = time.time()
|
29 |
+
print(f"Processing the input\n {input_text}\n")
|
30 |
+
print('Processing the answer....')
|
31 |
+
conversation = Conversation(input_text)
|
32 |
+
print(f"Conversation(input_text): {conversation}")
|
33 |
+
output = (chatbot(conversation))[1]['content']
|
34 |
+
elapsed_time = time.time() - start_time
|
35 |
+
#Add the last print statement to the output variable
|
36 |
+
output += f"\nAnswered in {elapsed_time:.1f} seconds, Nr generated words: {count_words(output)}"
|
37 |
+
|
38 |
+
return output
|
39 |
+
|
40 |
+
|
41 |
+
|
42 |
+
#gr.ChatInterface(get_answer(llm, text)).launch()
|
43 |
demo = gr.Interface(fn=get_answer, inputs="text", outputs="text")
|
44 |
demo.launch(share=True)
|