Spaces:
Sleeping
Sleeping
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() | |