Update app.py
Browse files
app.py
CHANGED
@@ -1,20 +1,16 @@
|
|
1 |
import gradio as gr
|
2 |
-
import pandas as pd
|
3 |
from hugchat import hugchat
|
4 |
|
5 |
chatbot = hugchat.ChatBot(cookie_path="cookies.json")
|
6 |
# Nuova a conversazione
|
7 |
id = chatbot.new_conversation()
|
8 |
chatbot.change_conversation(id)
|
9 |
-
#print(chatbot.chat("HI"))
|
10 |
|
11 |
-
df=pd.read_json('context.json',orient='index')
|
12 |
|
13 |
def parla(context, question):
|
14 |
|
15 |
############################################################################
|
16 |
-
# Qua puoi eventualmente aggiungere
|
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))
|
|
|
1 |
import gradio as gr
|
|
|
2 |
from hugchat import hugchat
|
3 |
|
4 |
chatbot = hugchat.ChatBot(cookie_path="cookies.json")
|
5 |
# Nuova a conversazione
|
6 |
id = chatbot.new_conversation()
|
7 |
chatbot.change_conversation(id)
|
|
|
8 |
|
|
|
9 |
|
10 |
def parla(context, question):
|
11 |
|
12 |
############################################################################
|
13 |
+
# Qua puoi eventualmente aggiungere alla domanda un contesto specifico
|
|
|
14 |
############################################################################
|
15 |
prompt="Rispondi alla domanda in base al seguente contesto:\n\nContesto:"+context+"\n\nDomanda: "+question
|
16 |
return(chatbot.chat(prompt,temperature=0.2))
|