|
import gradio as gr |
|
from hugchat import hugchat |
|
from hugchat.login import Login |
|
import os |
|
|
|
|
|
|
|
|
|
|
|
chatbot = hugchat.ChatBot(cookie_path="usercookies/rcudazzo@outlook.it.json") |
|
print(chatbot.chat("HI")) |
|
|
|
id = chatbot.new_conversation() |
|
chatbot.change_conversation(id) |
|
|
|
|
|
def parla(context, question,creativity): |
|
|
|
|
|
|
|
|
|
prompt="Rispondi alla domanda in base al seguente contesto:\n\nContesto:"+context+"\n\nDomanda: "+question |
|
return(chatbot.chat(prompt,temperature=float(creativity))) |
|
|
|
|
|
iface = gr.Interface( |
|
fn=parla, |
|
inputs=[gr.Textbox(lines=2, placeholder="Context for next question"),"text",gr.Slider(0,1,value=0.2,step=0.1)], |
|
outputs="text" |
|
) |
|
iface.launch() |