marse-chat / app.py
Prgckwb's picture
Create app.py
735ca22 verified
raw
history blame contribute delete
815 Bytes
import gradio as gr
import requests
def inference(message, history):
url = 'https://www.uec.ac.jp/uec-gpt/generate-response'
headers = {
'Content-Type': 'application/json',
'Referer': 'https://www.uec.ac.jp/'
}
body = {
'session_key': '',
'model': 'gpt-4o-mini',
'user_input': message,
}
response = requests.post(url, headers=headers, json=body)
return response.json()['response']
if __name__ == '__main__':
chat_iface = gr.ChatInterface(
fn=inference,
type='messages',
chatbot=gr.Chatbot([{'role': 'assistant', 'content': 'γͺγ‚“γ§γ‚‚θžγ„γ¦γ­'}], type='messages'),
theme=gr.themes.Soft(),
examples=['ι›»ι€šε€§γ¨γ―'],
title='γƒžγƒΌγƒ«γ‚Ήγγ‚“γ«γƒγƒ£γƒƒγƒˆγ§θ³ͺ問'
).launch()