Curaf commited on
Commit
eced77b
1 Parent(s): 6b79151

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -4
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(user_input):
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
- question="Rispondi alla domanda in base al seguente contesto:\n\nContesto:"+df['context'][0]+"\n\nDomanda: "+user_input
20
- return(chatbot.chat(question,temperature=0.2))
21
  ### Fine ###
22
 
23
- iface = gr.Interface(fn=parla, inputs="text", outputs="text")
 
 
 
 
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()