Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -97,15 +97,25 @@ prompt_template = PromptTemplate.from_template('''system role :{context} \
|
|
97 |
assistance:
|
98 |
''')
|
99 |
|
|
|
|
|
|
|
100 |
# Define Gradio Interface
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
)
|
|
|
|
|
|
|
|
|
|
|
|
|
107 |
|
108 |
# Launch Gradio Interface
|
109 |
-
|
|
|
110 |
|
111 |
# gr.load("models/ksh-nyp/llama-2-7b-chat-TCMKB").launch()
|
|
|
97 |
assistance:
|
98 |
''')
|
99 |
|
100 |
+
import random
|
101 |
+
import time
|
102 |
+
|
103 |
# Define Gradio Interface
|
104 |
+
with gr.Blocks() as chat:
|
105 |
+
chatbot = gr.Chatbot()
|
106 |
+
msg = gr.Textbox()
|
107 |
+
clear = gr.ClearButton([msg, chatbot])
|
108 |
+
|
109 |
+
def respond(message, chat_history):
|
110 |
+
# Use the global conversation variable here
|
111 |
+
response = conversation.run(message)
|
112 |
+
chat_history.append((message, response))
|
113 |
+
return response, chat_history
|
114 |
+
|
115 |
+
msg.submit(respond, [msg, chatbot], [msg, chatbot])
|
116 |
|
117 |
# Launch Gradio Interface
|
118 |
+
if __name__ == "__main__":
|
119 |
+
chat.launch()
|
120 |
|
121 |
# gr.load("models/ksh-nyp/llama-2-7b-chat-TCMKB").launch()
|