import streamlit as st from transformers import pipeline pipe1 = pipeline("text-classification", model="Emma0123/fine_tuned_model") pipe2 = pipeline("text-classification", model="jonas/roberta-base-finetuned-sdg") st.title("ESG with HuggingFace Spaces") st.write("Enter a sentence to analyze its ESG") input_text =st.text_input("") # 使用第一个模型进行预测 result1 = pipe1(input_text) # 判断第一个模型的输出结果 if result1[0]['label'] == 'environmental': # 根据您的模型实际返回的标签进行修改 result2 = pipe2(input_text) st.write(result2) else: # 如果输出结果为0(或者对应的标签),打印提示信息 st.write("This content is unrelated to Environment.")