Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -97,25 +97,16 @@ prompt_template = PromptTemplate.from_template('''system role :{context} \
|
|
| 97 |
assistance:
|
| 98 |
''')
|
| 99 |
|
| 100 |
-
import random
|
| 101 |
-
import time
|
| 102 |
-
|
| 103 |
# Define Gradio Interface
|
| 104 |
-
|
| 105 |
-
|
| 106 |
-
|
| 107 |
-
|
| 108 |
-
|
| 109 |
-
|
| 110 |
-
|
| 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 |
-
|
| 119 |
-
chat.launch()
|
| 120 |
|
| 121 |
# gr.load("models/ksh-nyp/llama-2-7b-chat-TCMKB").launch()
|
|
|
|
| 97 |
assistance:
|
| 98 |
''')
|
| 99 |
|
|
|
|
|
|
|
|
|
|
| 100 |
# Define Gradio Interface
|
| 101 |
+
iface = gr.Interface(
|
| 102 |
+
fn=lambda query: conversation.run(prompt_template.format(context=context, query=query)),
|
| 103 |
+
inputs=gr.Textbox(),
|
| 104 |
+
outputs=gr.Textbox(),
|
| 105 |
+
live=True,
|
| 106 |
+
capture_session=True
|
| 107 |
+
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 108 |
|
| 109 |
# Launch Gradio Interface
|
| 110 |
+
iface.launch()
|
|
|
|
| 111 |
|
| 112 |
# gr.load("models/ksh-nyp/llama-2-7b-chat-TCMKB").launch()
|