import gradio as gr import requests url = "https://api.edenai.run/v2/text/sentiment_analysis" def sentiment_analysis(inp_text): payload = { "response_as_dict": True, "attributes_as_list": False, "show_original_response": False, "providers": "google", "text": inp_text, "language": "ko" } headers = { "accept": "application/json", "content-type": "application/json", "authorization": "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjoiMWI0NzY4YzMtNmM0NC00NThiLTkyMjctNDFhMDVjZDlkZTMxIiwidHlwZSI6ImFwaV90b2tlbiJ9.6nsuq67zZlBXqpH0VUNud64Ii54ETQay0Antfslpsqg" } response = requests.post(url, json=payload, headers=headers) return response.text inp_text = gr.inputs.Textbox(label='Input') response = gr.outputs.Textbox(label='Output') gr.Interface(function=sentiment_analysis, inputs=inp_text, outputs=response, title='Sentiment Analysis', theme='peach').launch(enable_queue=True)