Update app.py
Browse files
app.py
CHANGED
@@ -10,15 +10,19 @@ chatbot.change_conversation(id)
|
|
10 |
|
11 |
df=pd.read_json('context.json',orient='index')
|
12 |
|
13 |
-
def parla(
|
14 |
|
15 |
############################################################################
|
16 |
# Qua puoi eventualmente aggiungere allo user_input un contesto esterno
|
17 |
# Come test fai la domanda "che libri ha scritto raffaele cudazzo?"
|
18 |
############################################################################
|
19 |
-
|
20 |
-
return(chatbot.chat(
|
21 |
### Fine ###
|
22 |
|
23 |
-
iface = gr.Interface(
|
|
|
|
|
|
|
|
|
24 |
iface.launch()
|
|
|
10 |
|
11 |
df=pd.read_json('context.json',orient='index')
|
12 |
|
13 |
+
def parla(context, question):
|
14 |
|
15 |
############################################################################
|
16 |
# Qua puoi eventualmente aggiungere allo user_input un contesto esterno
|
17 |
# Come test fai la domanda "che libri ha scritto raffaele cudazzo?"
|
18 |
############################################################################
|
19 |
+
prompt="Rispondi alla domanda in base al seguente contesto:\n\nContesto:"+context+"\n\nDomanda: "+question
|
20 |
+
return(chatbot.chat(prompt,temperature=0.2))
|
21 |
### Fine ###
|
22 |
|
23 |
+
iface = gr.Interface(
|
24 |
+
fn=parla,
|
25 |
+
inputs=[gr.Textbox(lines=2, placeholder="Context for next question"),"text"],
|
26 |
+
outputs="text"
|
27 |
+
)
|
28 |
iface.launch()
|